Skip to content

Instantly share code, notes, and snippets.

@lukesmurray
Created February 12, 2021 18:23
Show Gist options
  • Save lukesmurray/b840a9ad70c9d64a4b61c3ceedc78683 to your computer and use it in GitHub Desktop.
Save lukesmurray/b840a9ad70c9d64a4b61c3ceedc78683 to your computer and use it in GitHub Desktop.
Git Local
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