Fix gut add and commit commands

* Add `gut root` command
* Remove alias commands (for now)
This commit is contained in:
Dylan Lom 2021-04-24 14:16:07 +10:00
parent c28f163394
commit c879754b5d
1 changed files with 10 additions and 19 deletions

View File

@ -17,11 +17,15 @@
# THIS SOFTWARE. # THIS SOFTWARE.
# #
# CHRISTMAS GIT MAGIC root() {
git rev-parse --show-toplevel
}
add() { add() {
truthy "$1" \ truthy "$1" \
&& git add $1 \ && git add $1 \
#|| (for f in $(git status --porcelain | cut -c4-); do) || (for f in $(git status --porcelain | cut -c4-); do \
confirm "Add $f?" && git add "$(root)/$f"; done)
} }
alias co='checkout' alias co='checkout'
@ -38,35 +42,22 @@ stash() {
|| git stash push || git stash push
} }
# Is anything already staged # Is anything already added (staged)
# then: commit that # then: commit that
# else: stage and commit everything # else: stage and commit everything
commit() { commit() {
status status
git status --porcelain | grep '^[^ ]*A' \ git status --porcelain | grep -q '^[^ ]*A' \
&& git commit -a \ && git commit \
|| (git add . && git commit "$1") || (git add -p; git commit)
} }
amend() { amend() {
git commit --amend -a git commit --amend -a
} }
push() {
git push $1
}
alias update='pull'
pull() {
git pull $1
}
status() { status() {
git status --short git status --short
} }
diff() {
git diff $1
}
$@ $@