-
-
Save thekarel/9294013 to your computer and use it in GitHub Desktop.
Track the branch with the same name as the current on origin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Track the branch with the same name as the current on origin | |
# To set up an alias `git track`, run | |
# | |
# git config --global --add alias.track '!git-track' | |
# | |
# (via https://gist.github.com/graysky/29079/) | |
branch=$(git describe --contains --all HEAD) | |
echo "OK to run?" | |
echo " " | |
echo " git config branch.$branch.remote origin" | |
echo " git config branch.$branch.merge refs/heads/$branch" | |
echo " " | |
echo "Enter to run, ctrl-c to cancel" | |
read x | |
git config branch.$branch.remote origin | |
git config branch.$branch.merge refs/heads/$branch | |
echo "tracking origin/$branch" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment