bin/git-fixup
2017-04-10 08:37:39 -07:00

17 lines
374 B
Bash
Executable file

#!/bin/bash
#
# From https://blog.filippo.io/git-fixup-amending-an-older-commit/
set -e
function usage() {
name=$(basename "$0")
echo "Usage: ${name} <commit-ish> [git commit arguments]" >&2
exit 1
}
[[ -z "$1" ]] && usage
target=$(git rev-parse "$1")
git commit --fixup="$target" "${@:2}"
VISUAL=true EDITOR=true git rebase -i --autostash --autosquash "$target^"