Git - git checkout

git

git checkout -b mine master // create a new local branch named 'mine' from the 
  // local branch named master, and checkout the local branch named 'mine' that 
  // is just created

How can we create a new branch from inside our current working directory?

git checkout -b linux-work

How can we checkout a specific branch?

git checkout branchName
git checkout master

How can we move our tree to some older revision?

git checkout rev
git checkout prevbranch

How can we create a new branch and automatically switch to using it?

Use the -b option with the checkout command:

git checkout -b test2

How can we switch over to the new branch that we just created?

git checkout test

This command moves the HEAD pointer to the test branch.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License