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
}
# Is anything already added (staged)
# then: commit that
# else: stage and commit everything
# If anything already added (staged):
# then commit that
# else prompt user to stage then commit
commit() {
status
git status --porcelain | grep -q '^[^ ]*A' \
&& git commit \
|| (add; git commit)
|| (status; add; git commit)
}
# If anything already added (staged):
# then amend that
# else amend all
amend() {
git commit --amend -a
git status --porcelain | grep -q '^[^ ]*A' \
&& git commit --amend \
|| git commit --amend -a
}
status() {