Is there a way to make a branch directly accessible after a git fetch without git checkout <newbranch>?
git fetch
git checkout <newbranch>
If I use the git fetch command I want to see the new branches directly in the list shown after I use e.g. git branch.
git branch
If by "accessible" you mean visible in the list given by git branch then you can use the -a flag:
-a
git branch -a
it will show all the branches including the remote tracking ones.
So if someone added second_branch to the remote repository, before running git fetch you might see:
second_branch
%> git branch -a * master remotes/origin/master
Then after the git fetch you might see:
%> git branch -a * master remotes/origin/master remotes/origin/second_branch
If you only want to see the remote tracking branches there's also the -r option.
-r
If by "accessible" you mean visible in the list given by
git branch
then you can use the-a
flag:it will show all the branches including the remote tracking ones.
So if someone added
second_branch
to the remote repository, before runninggit fetch
you might see:Then after the
git fetch
you might see:If you only want to see the remote tracking branches there's also the
-r
option.