Skip to content

Instantly share code, notes, and snippets.

@BenFradet
Created July 20, 2017 09:20
Show Gist options
  • Save BenFradet/370e99e18ee94c0b3c825a4f6d124268 to your computer and use it in GitHub Desktop.
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
#!/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