Ninfoo·11 ปีที่แล้ว·discussNice idea!But, be aware that this doesn't work to inject into the initial commit.I hope you don't mind that I streamlined your original code a bit to make it more readable. This can be put directly into the .bashrc, .zshrc, etc: inject() { local HASH=$1; shift 1 git commit --fixup=$HASH if [ -n "$(git diff-files)" ] then git stash trap "git stash pop" EXIT fi git rebase $HASH^ -i --autosquash }
But, be aware that this doesn't work to inject into the initial commit.
I hope you don't mind that I streamlined your original code a bit to make it more readable. This can be put directly into the .bashrc, .zshrc, etc: