Created
December 11, 2012 04:16
-
-
Save mhart/4255836 to your computer and use it in GitHub Desktop.
Script to fixup/squash commits given on a cmd line - can be used as a Custom Action in SourceTree
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
#!/bin/bash | |
lastCommit="" | |
editorCmd="sed -i ''" | |
for commit in $@; do | |
lastCommit=${commit:0:7} | |
editorCmd="$editorCmd -e 's/pick ${lastCommit}/fixup ${lastCommit}/'" | |
done | |
GIT_SEQUENCE_EDITOR=$editorCmd git rebase -i ${lastCommit}~2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent! Now if only Source Tree would allow you to pass a new commit message to apply to the squashed commit.