Skip to content

Instantly share code, notes, and snippets.

@rjuju
Forked from cypher/gist:29095
Created May 18, 2013 12:10
Show Gist options
  • Save rjuju/5604213 to your computer and use it in GitHub Desktop.
Save rjuju/5604213 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