Last active
August 14, 2018 13:54
-
-
Save 0livare/d69c6ded2b8e9fb301d70f851d95a3e8 to your computer and use it in GitHub Desktop.
Move a local branch to a different commit
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/bash | |
# FOR ANYONE READING THIS, simply use 'git branch -f`, it even has the same syntax as this script | |
# If there are 0 or 1 arguments | |
if [ $# -eq 0 ] || [ $# -eq 1 ] | |
then | |
echo "Usage: git move <BRANCH-NAME> <BRANCH-POINTER>" | |
exit 1 | |
fi | |
git branch -D $1 | |
git branch $1 $2 | |
echo "" | |
echo "Branch $1 moved to $2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment