Created
July 17, 2018 14:40
-
-
Save philmtd/31f21a88ce3cc67e36c8f457e45a0322 to your computer and use it in GitHub Desktop.
Squash Cherry Pick the passed commit hashes and commit immediately using all original commit messages.
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
#!/bin/sh | |
export LC_CTYPE="UTF-8" | |
reverse() { | |
local result= | |
for word in $@; do | |
result="$word $result" | |
done | |
echo "$result" | |
} | |
SHA=$(reverse $@) | |
echo $SHA | |
git cherry-pick -n $SHA | |
MSG="" | |
if [[ $# -gt 1 ]]; then | |
MSG="$#-in-1-Commit: " | |
fi | |
MSG="$MSG$(git show -s --format=%B $@)" | |
echo $MSG | |
git commit -m "$MSG" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment