diff options
author | Adam Spiers <git@adamspiers.org> | 2018-10-03 00:33:33 +0100 |
---|---|---|
committer | Adam Spiers <git@adamspiers.org> | 2018-10-03 14:52:14 +0100 |
commit | bd07e46deef6b919395e55a66b667482b0630f3e (patch) | |
tree | 6e7fa40522faa714cb3149c6474f131a8db1cbaa /bin | |
parent | 514cfc62a87b32935b9432002221e37820973565 (diff) | |
download | git-deps-bd07e46deef6b919395e55a66b667482b0630f3e.tar.gz |
add git-fixup and documentation for use case
This is a nice new use case for git-deps which makes it even easier
to amend commits buried in the history.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/git-fixup | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/git-fixup b/bin/git-fixup new file mode 100755 index 0000000..a79c655 --- /dev/null +++ b/bin/git-fixup @@ -0,0 +1,17 @@ +#!/bin/bash + +if ! git commit -m 'fixup commit'; then + echo >&2 "Failed to create fixup commit; aborting." + exit 1 +fi + +deps=( $( git deps HEAD^! ) ) +if [ ${#deps[@]} != 1 ]; then + echo >&2 "Failed to find a single dependency of the fixup commit; aborting." + git reset --soft HEAD^ + exit 1 +fi + +git commit --amend --fixup=$deps + +# TODO: support optionally triggering the rebase. |