Reputation: 121
I am very new to git. Trying to figure some stuff out, so pls be gentle :-)
I'm trying to understand why git seems to create a new branch after an upstream git push.
starting sitation:
git checkout
says
FETCH_HEAD HEAD master pep-complaincy
then i do
git push --set-upstream pep8compliancy
and i get
FETCH_HEAD HEAD master pep8compliancy/pep-complaincy pep-complaincy
They way I understand is that by doing the push command, I link my local "pep-complaincy" branch to a remote "pep8complaincy" branch.
I would expect the output of "git checkout" either to read "pep-complaincy" (not showing the remote branch) OR to read "pep8compliancy/pep-complaincy" (indicating that the local branch is now linked to a remote branch).
Can't figure out why git is now showing 2 branches. Any help explaining this would be greatly appreciated.
Upvotes: 1
Views: 70
Reputation: 1325195
First, don't use git checkout
. It is an old, obsolete and confusing command used to:
git switch
)git restore
)Second, if you want to see the branches (local and remote) and their relationship, use:
git branch -avv
Upvotes: 2
Reputation: 881653
git push --set-upstream pep8compliancy
This will create a relationship between your current local branch (which is master
) and the upstream branch pep8compliancy
, which should probably be called pep8compliance
so as to not offend the grammar Nazis out there :-)
If you want a new branch with the same upstream name, that would have been something like:
git co master # Start with master as baseline.
git pull # Ensure up to date.
git co -b pep8compliancy # New local branch at same point.
git push --set-upstream pep8compliancy # Push to upstream, linking names.
Upvotes: 0