How do I check out a remote Git branch?

Following tutorial shows that how you can check out on a GIT branch that does not exists local.

1. First you need to fetch a remote branches from remote repository.

Use the following command to fetch all branches

git fetch --all

 

Then all remote branches will come in your local git stack now you only need to checkout that branch.

git checkout <branch>

 

 

You can also create a new branch and checkout at that branch. you only need to checkout at your desired branch at which you want to create branch use the following commands in your terminal in the project directory

# checkout at your parent branch 
git checkout master

# create a new branch
git branch newbranch

# change environment to the new branch
git checkout newbranch

 


Tags:

git

Share:

Related posts