Created
February 12, 2021 18:23
-
-
Save lukesmurray/b840a9ad70c9d64a4b61c3ceedc78683 to your computer and use it in GitHub Desktop.
Git Local
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
glocal () { | |
echo "### Adding any wip files" | |
git add . | |
echo "### Committing files with a temporary commit" | |
git commit --no-verify -am 'local commit - work in progress' | |
echo "### Checking out branch" | |
git checkout "$1" | |
x="$(git log -1 --pretty=%B)" | |
if [ "$x" = "local commit - work in progress" ] | |
then | |
echo "### Undoing last commit" | |
git reset --soft HEAD^ | |
else | |
echo "### Not undoing last commit" | |
fi | |
echo "glocal complete" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment