git-shatter
Wed Apr 25 15:15:50 2018
Here is a script that will output commands to break up the head git commit into a separate commit for each file. Public domain.
#!/bin/sh
#break up a given commit into separate commits, one for each file
#commit=$(git rev-parse "${1:-HEAD}")
commit=HEAD
#git rebase -i
author=$(git log -n1 $commit --format='%an <%ae>')
authdate=$(git log -n1 $commit --format='%ad')
msg=$(git log -n1 $commit --format='%B')
# while read?
echo git reset HEAD^
git diff-tree --no-commit-id --name-only -r $commit -z |
xargs -0 -n1 -IFILE echo git add FILE '&&' git commit -C $commit -uno
Posted in / software