Skip to content

Instantly share code, notes, and snippets.

View rjuju's full-sized avatar

Julien Rouhaud rjuju

View GitHub Profile
# 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