Skip to content

Instantly share code, notes, and snippets.

@vifon
Last active October 7, 2015 16:47
Show Gist options
  • Save vifon/3195561 to your computer and use it in GitHub Desktop.
Save vifon/3195561 to your computer and use it in GitHub Desktop.
git fixup
#!/bin/sh
# USAGE: git fixup [commit hash or something]
# Adds the staged changes to the specified commit.
if [ -n "$1" ]; then
git stash --keep-index
git commit --fixup="$1" &&
GIT_EDITOR=vim git rebase --autosquash --interactive "$1~1"
git stash pop
else
echo "Missing argument" 1>&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment