Created
June 4, 2020 00:59
-
-
Save dlip/683f881924f7ff448b6c6f4c65360632 to your computer and use it in GitHub Desktop.
Git checkout latest on a different branch without moving your HEAD twice
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
# Git checkout latest on a different branch without moving your HEAD twice | |
gcol() { | |
if [ -z $1 ]; then | |
echo "Error: Please provide branch name" | |
return | |
fi | |
git fetch | |
git branch -f $1 origin/$1 | |
git checkout $1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment