Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I don't get the error "fatal: The current branch A has no upstream branch."

Tags:

git

git-remote

It's about why I do not get the error "fatal: The current branch A has no upstream branch."

I deleted the REMOTE branch A with the command git push origin :A . Then I switched to LOCAL branch A with the command git checkout A . After adding, commiting and pushing, I don't get the error "fatal: The current branch A has no upstream branch."

Why does this error not appear even though the remote branch A does not exist because I deleted it before?

like image 395
software Avatar asked Jan 24 '23 07:01

software


1 Answers

Because the error you expect to have is not related to the existence or not of the branch in the remote. It is related to the fact that your local branch has a "destination" defined ("upstream branch").

When you delete the remote branch, you don't unset the upstream branch from your local branch.

Your local branch can have a upstream branch defined that doesn't exist yet/anymore.

like image 78
Gaël J Avatar answered Jan 27 '23 06:01

Gaël J