add git-fixup
This commit is contained in:
parent
0a90854018
commit
f4f6e9da0c
1 changed files with 17 additions and 0 deletions
17
git-fixup
Executable file
17
git-fixup
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/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^"
|
||||||
Loading…
Reference in a new issue