Created
March 3, 2016 11:48
-
-
Save mochja/ea262354067efa2a1ce2 to your computer and use it in GitHub Desktop.
Spread changes to last file modification
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 | |
for f in $(git status --porcelain); do | |
if [ -f "$f" ]; then | |
hash=$(git log -n1 --pretty=%H "$f") | |
if [ ! -z "$hash" ]; then | |
git add "$f" && git commit --fixup "$hash" | |
fi; | |
fi | |
done | |
echo "Run `git rebase -i <branch> --autosquash` to apply the changes." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment