P
P
pegas2018-10-17 12:13:59
git
pegas, 2018-10-17 12:13:59

Why did you switch to a non-existent branch?

On the remote server there are 3 branches master , branch1 , branch2 when cloning with git clone I want to see which branches are available to me and I write git branch , it only shows me the master branch . But when I switch to branch1 with git checkout branch1 , the switch succeeds.
Why did I switch to the branch1 branch if this branch does not exist. because git branch didn't show it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
neol, 2018-10-17
@1PeGaS

git branch with no options shows only local branches
git branch -r shows only branches of the remote repository
git branch -a shows all
If you switch to a branch that does not exist locally, but exists in the remote repository, it is automatically pulled from the server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question