Difference between revisions of "TubeTK/Development/GITCheatSheet"

From KitwarePublic
Jump to navigationJump to search
Line 1: Line 1:
= Create a checkout =
= Create a checkout =
*git clone git://gitorious.org/tubetk/tubetk.git
* git clone git://gitorious.org/tubetk/tubetk.git


= Push local changes =
 
*git push origin master
= Stash local changes temporarily =
* git stash
 
= Create a local branch =
* git branch test
 
= Swtich to a local branch =
* git checkout test
 
= Get stashed local changes =
* git stash pop
 
= Update a branch to the remote master's head =
* git stash
* git rebase origin master
* git stash pop
 
= Add to local commit =
* git add <filename>
* git add -A
 
= Push local commit =
* git push origin master
 
= Remove a local branch =
* git checkout master
* git branch -d <branch>


= Track a remote branch =
= Track a remote branch =
* "git fetch" (get up to date) or "git pull"
* "git fetch" (get up to date) or "git pull"
*git branch --track somebranch origin/somebranch  
* git branch --track somebranch origin/somebranch  
** --track is not needed unless you've set branch.autosetupmerge to false in your config
** --track is not needed unless you've set branch.autosetupmerge to false in your config
*git checkout somebranch
* git checkout somebranch
*git commit  
* git commit  
*git push
* git push
** sends changes to origin/somebranch
** sends changes to origin/somebranch



Revision as of 14:04, 3 February 2010

Create a checkout


Stash local changes temporarily

  • git stash

Create a local branch

  • git branch test

Swtich to a local branch

  • git checkout test

Get stashed local changes

  • git stash pop

Update a branch to the remote master's head

  • git stash
  • git rebase origin master
  • git stash pop

Add to local commit

  • git add <filename>
  • git add -A

Push local commit

  • git push origin master

Remove a local branch

  • git checkout master
  • git branch -d <branch>

Track a remote branch

  • "git fetch" (get up to date) or "git pull"
  • git branch --track somebranch origin/somebranch
    • --track is not needed unless you've set branch.autosetupmerge to false in your config
  • git checkout somebranch
  • git commit
  • git push
    • sends changes to origin/somebranch

Delete a remote branch

  • Don't do this unless you're incredibly confident in what you're doing
  • git push origin :somebranch