Git checkout -b branchname is called on a pre-existing branch; was the old one rewritten?

I cloned a large, well-kept repository. Incidentally, I used the -b flag when checking out another branch. Git says "Switch to new branch." Was a preexisting branch rewritten, was Git's output misleading, or did I make another mistake?

+4
source share
1 answer

Whether the previous branch was overwritten,

No.
The default branch is disabled , and a new local branch has been created from its HEAD.

You can see all branches with:

 git branch -a 

Just go back to the branch of your choice with

 git checkout -b aBranch --track origin/aBranch # if the local branch was already there git checkout -B aBranch --track origin/aBranch 

Please note that if you have work, you need to go git stash , as described in To git checkout without overwriting data . "

+10
source

All Articles