Skip to content

Instantly share code, notes, and snippets.

@mgirouard
Created February 29, 2012 15:29
Show Gist options
  • Save mgirouard/1941642 to your computer and use it in GitHub Desktop.
Save mgirouard/1941642 to your computer and use it in GitHub Desktop.
Random, but incredibly awesome Git snippets to remember

Set an existing local branch to track another local branch

Use git-branch with a --set-upstream flag:

$ git branch --set-upstream v1.0.10 development
Branch v1.0.10 set up to track local branch development.

Set an existing local branch to track a remote branch

Similar to the above, git branch be used to set an existing local branch to track an upstream remote, without push'ing:

$ git branch --set-upstream v1.0.10 origin/v1.0.10

And, of course, if you are pushing, it might just be easier to add a -u during your push to save some keystrokes:

$ git push -u origin v1.0.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment