Created
December 4, 2012 00:31
-
-
Save ataliba/4199368 to your computer and use it in GitHub Desktop.
gpuf
This file contains hidden or 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
gpuf () { | |
# git pull -f $1 | |
remote=${1:?"need remote to force pull from"} | |
current_branch=$(git symbolic-ref -q HEAD) | |
current_branch=${current_branch##refs/heads/} | |
current_branch=${current_branch:-HEAD} | |
if [ $current_branch = 'HEAD' ] ; then | |
echo | |
echo "On a detached head. Exiting..." | |
exit 1 | |
fi | |
git fetch $remote $current_branch | |
git reset --hard FETCH_HEAD | |
git clean -df | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tip about the force pull on git:
http://www.snowfrog.net/2012/12/03/git-pull-f-git-force-pull/