aboutsummaryrefslogblamecommitdiffstats
path: root/bin/git-fixup
blob: a79c65524b41563b555a0ac5d03b825f4749d5eb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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.