Difference between revisions of "Git phrasebook"

From Creative Commons
Jump to: navigation, search
(Phrasebook begins)
 
m (Creating a new local branch that tracks a remote branch)
Line 8: Line 8:
 
== Creating a new local branch that tracks a remote branch ==
 
== Creating a new local branch that tracks a remote branch ==
  
  git checkout --track LOCALFUN remote/REMOTE_BRANCH_NAME
+
  git branch --track LOCALFUN remote/REMOTE_BRANCH_NAME
 
  git checkout LOCALFUN
 
  git checkout LOCALFUN
 
  git pull # You should see, "Already up-to-date."
 
  git pull # You should see, "Already up-to-date."

Revision as of 23:46, 11 June 2008

Everything in ALLCAPS should be considered something you think about before typing.

Checking out a project

git clone PROJECT_URL
git branch -a # Take a look at all the remote branches you can pick from.

Creating a new local branch that tracks a remote branch

git branch --track LOCALFUN remote/REMOTE_BRANCH_NAME
git checkout LOCALFUN
git pull # You should see, "Already up-to-date."

Switching which branch you are on

git checkout <BRANCH_NAME>

NOTE: Do not use this to create branches!