Skip to content

Instantly share code, notes, and snippets.

@cypher
Created July 8, 2009 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cypher/142803 to your computer and use it in GitHub Desktop.
Save cypher/142803 to your computer and use it in GitHub Desktop.
git config --global alias.track '! track() {
branch=$(git branch | sed -ne "s/^\*\ \(.*\)$/\1/p")
remote=$1
git config "branch.$branch.remote" $(dirname "$remote")
git config "branch.$branch.merge" "refs/heads/$(basename "$remote")"
}
track'
git track origin/foobar # sets up the current branch to track origin/foobar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment