Skip to content

Instantly share code, notes, and snippets.

@luigi
Created September 18, 2009 15:39
Show Gist options
  • Save luigi/189116 to your computer and use it in GitHub Desktop.
Save luigi/189116 to your computer and use it in GitHub Desktop.

Local and remote branches

Create and checkout topic branch

gt start my_topic

Create and checkout topic branch with corresponding remote branch

gt start_and_pushup my_topic

Rebase topic branch (assumed to be master)

gt catchup 

Checkout master branch, merge in topic branch

gt foldin

Push to remote origin/*, prompt to create if it doesn't exist (push origin HEAD)

gt pushup

Pull from origin/*, don't merge if you have non-pushed commits

gt pulldown

Track existing remote branch

gt follow other_topic

Rename branch (will rename remote branch if it's being tracked)

gt rename old_name new_name

View branches

gt branches

Delete a branch (and its remote branch if it exists)

gt remove dying_branch

Staging and Commits

Add changed file to staging area

gt stage

Remove changed file from staging area (reset HEAD)

gt unstage

Force add and delete all changes to staging area (add --all)

gt stage_all

Abandon everything since last commit (reset --hard)

gt unstage_all

Abandon everything staged and committed locally, but not pushed (reset --hard ORIG_HEAD)

gt uncommit_all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment