Showing posts with label remote branch checkout. Show all posts
Showing posts with label remote branch checkout. Show all posts

Wednesday, April 29, 2015

Git:Checkout to newly added remote branch

For example, If new branch is added to the repository and now you wanted to setup that in your local system.

$ git fetch

This will look up the origin and update the local repository with the new data.

For example, newly added branch is 'master'. It will show something like this.
master->origin/master

$ git branch -r

Above command tell you what are all the remote branches available.

$git checkout -b master origin/master

This will create a new branch 'master' and will have a synch with remote branch /origin/master'


KKOLIPAKA-MBP:$ git fetch
From https://github.com/kolipakakondal/titanium_studio
 * [new branch]      master -> origin/master

KKOLIPAKA-MBP:$ git branch -r
  origin/HEAD -> origin/development
  origin/development
  origin/master
  upstream/release

KKOLIPAKA-MBP:$ git checkout -b master origin/master
Checking out files: 100% (453/453), done.
Branch master set up to track remote branch master from origin.

Switched to a new branch 'master'