Difference between revisions of "Git phrasebook"

From Creative Commons
Jump to: navigation, search
(Deleting a remote branch)
(Deleting a remote branch)
Line 17: Line 17:
  
 
NOTE: Do not use this to '''create''' branches!
 
NOTE: Do not use this to '''create''' branches!
 +
 +
== Making a local branch available as a remote branch ==
 +
git push origin LOCAL_BRANCH_NAME:refs/heads/REMOTE_BRANCH_NAME
  
 
== Deleting a remote branch ==
 
== Deleting a remote branch ==
 
  git push origin :BRANCH_NAME_TO_DELETE
 
  git push origin :BRANCH_NAME_TO_DELETE

Revision as of 23:19, 24 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."
git push # You should see, "Everything up-to-date"

Switching which branch you are on

git checkout <BRANCH_NAME>

NOTE: Do not use this to create branches!

Making a local branch available as a remote branch

git push origin LOCAL_BRANCH_NAME:refs/heads/REMOTE_BRANCH_NAME

Deleting a remote branch

git push origin :BRANCH_NAME_TO_DELETE