fix(shell): git recommit command

When running git commit it was supposed to update the commit message you are
currently working on. When running commit with git hooks setup the commit may
fail due to a invalid message.

This now splits out the command so you can run `grc` (git recommit) to reedit
the commit message that failed rather then having to enter the message again in
a new commit message.
This commit is contained in:
Ade Attwood 2021-11-21 15:58:55 +00:00
parent 92c00ca15c
commit 13845d5098

View file

@ -22,10 +22,13 @@ function ggpushpr() {
fi fi
} }
function gc() { function grc() {
if [[ -f "$(git rev-parse --show-toplevel)/.git/COMMIT_EDITMSG" ]]; then cat "$(git rev-parse --show-toplevel)/.git/COMMIT_EDITMSG" \
git commit -t "$(git rev-parse --show-toplevel)/.git/COMMIT_EDITMSG" | grep -B 99999999 '# ------------------------ >8 ------------------------' \
else > "$(git rev-parse --show-toplevel)/.git/COMMIT_TEMPLATE"
git commit -v
git commit -t "$(git rev-parse --show-toplevel)/.git/COMMIT_TEMPLATE"
}
fi fi
} }