Tidy up gut commit some more, improve gut amend

This commit is contained in:
Dylan Lom 2021-04-24 20:58:54 +10:00
parent e5ab9fa976
commit 4cf693abd0
1 changed files with 10 additions and 6 deletions

View File

@ -42,18 +42,22 @@ stash() {
|| git stash push || git stash push
} }
# Is anything already added (staged) # If anything already added (staged):
# then: commit that # then commit that
# else: stage and commit everything # else prompt user to stage then commit
commit() { commit() {
status
git status --porcelain | grep -q '^[^ ]*A' \ git status --porcelain | grep -q '^[^ ]*A' \
&& git commit \ && git commit \
|| (add; git commit) || (status; add; git commit)
} }
# If anything already added (staged):
# then amend that
# else amend all
amend() { amend() {
git commit --amend -a git status --porcelain | grep -q '^[^ ]*A' \
&& git commit --amend \
|| git commit --amend -a
} }
status() { status() {