#!/bin/bash
err() {
echo "Error: $@" >&2
exit $EXIT_FAILURE
}
git rev-parse --is-inside-work-tree &>/dev/null || err "Not inside a work tree"
[ -z "$(git diff --staged --name-only)" ] || err "Stage is not empty"
for dirtyfile in $(git diff --name-only) ; do
commit_message=$(git log --oneline -- "$dirtyfile" | head -1 | sed 's/^\w* //g')
git commit -m "fixup! ${commit_message}" -- "${dirtyfile}"
done
These are the sort of tools that are unlikely to be shipped with a VCS, but would fit nicely into a workbench tool-shed. Of course, there can be much more sophisticated tools as well as whole toolsets describing workflows.
No comments:
Post a Comment