Last active
May 28, 2016 19:43
-
-
Save Jupiterrr/c80b21fd47899aaafbb5f2b87800b91e to your computer and use it in GitHub Desktop.
git-rebase-edit - helper for editing old commits via `rebase -i`
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
#!/usr/bin/env bash | |
set -e | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: git edit REV" | |
exit | |
fi | |
# CHECK SHA AND PARSE IT | |
if ! SHA=$(git rev-parse --verify --short $1 2>/dev/null); then | |
echo "fatal: bad revision '$1'" | |
exit | |
fi | |
EDITOR_CMD="sed -ie 's/^pick $SHA/edit $SHA/'" | |
GIT_SEQUENCE_EDITOR=$EDITOR_CMD git rebase -i $SHA~1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment