Skip to content

Instantly share code, notes, and snippets.

@cypher
Created November 25, 2008 21:19
Show Gist options
  • Save cypher/29095 to your computer and use it in GitHub Desktop.
Save cypher/29095 to your computer and use it in GitHub Desktop.
# Add the alias
git config --global alias.retrack '!retrack() { git config "branch.$1.remote" $(dirname "$2"); git config "branch.$1.merge" "refs/heads/$(basename "$2")"; }; retrack'
# We want the local branch 'mybranch' to track the remote branch 'origin/mybranch':
git retrack mybranch origin/mybranch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment