Created
July 20, 2017 09:20
-
-
Save BenFradet/370e99e18ee94c0b3c825a4f6d124268 to your computer and use it in GitHub Desktop.
When applying modifications from a code review, squashing those modifications to the last commit for a particular file
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/bash | |
file=$1 | |
IFS=' ' read h m <<< $(git log -n 1 --oneline $file) | |
git add $file | |
git commit -m "fixup! $m" | |
git rebase -i --autosquash $h^1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment