Fix gut add and commit commands
* Add `gut root` command * Remove alias commands (for now)
This commit is contained in:
parent
c28f163394
commit
c879754b5d
29
src/gut.sh
29
src/gut.sh
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
$@
|
$@
|
||||||
|
|
Loading…
Reference in New Issue