git : convert aliases to functions.

This commit is contained in:
Dmitry Voronin 2023-12-07 00:24:26 +03:00
parent cf121cd31b
commit 21018f0468
2 changed files with 93 additions and 21 deletions

View file

@ -528,8 +528,8 @@ Command|Description
`gf`|Git fetch --all.
`gt`|Git tag.
`gi`|Delete files updated in git ignore.
`gpc`|Git patch create.
`gp`|Git patch (apply).
`gpc <FILE>`|Git patch create.
`gp <FILE>`|Git patch (apply).
`ga`|Git add with preview.
`gr [COUNT]`|Git rebase. 2 last commits by default. 0 means from root.
`gu <EMAIL>`|Configure git user as Dmitry Voronin with specified email (project).

View file

@ -1,22 +1,94 @@
# short aliases.
alias gps="git push"
alias gpsf="git push --force"
alias gpl="git pull"
alias gl="git log"
alias gs="git status"
alias gst="git stash"
alias gd="git diff"
alias gc="git commit -m"
alias gch="git checkout"
alias gchb="git checkout -b"
alias gb="git branch --all"
alias gbd="git branch -D"
alias gbda="git branch | grep -v ^* | xargs git branch -D"
alias gf="git fetch --all -v -p"
alias gt="git tag"
alias gi="git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached"
alias gpc="git diff >"
alias gp="git apply"
# Git push.
gps() {
git push "${@}"
}
# Git force push.
gpsf() {
git push --force "${@}"
}
# Git pull.
gpl() {
git pull "${@}"
}
# Git log.
gl() {
git log "${@}"
}
# Git status.
gs() {
git status "${@}"
}
# Git stash.
gst() {
git stash "${@}"
}
# Git diff.
gd() {
git diff "${@}"
}
# Git commit.
gc() {
git commit -m "${@}"
}
# Git checkout.
gch() {
git checkout "${@}"
}
# Git checkout branch.
gchb() {
git checkout -b "${@}"
}
# Git branch.
gb() {
git branch --all "${@}"
}
# Git branch delete.
gbd() {
git branch -D "${@}"
}
# Git branch delete all except current.
gbda() {
git branch | grep -v ^* | xargs git branch -D
}
# Git fetch all.
gf() {
git fetch --all -v -p
}
# Git tag.
gt() {
git tag "${@}"
}
# Git ignore files.
gi() {
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
}
# Git patch create.
# Usage: gpc <FILE>
gpc() {
git diff > "${@}"
}
# Git patch (apply).
# Usage: gp <FILE>
gp() {
git apply "${@}"
}
# Run git garbage collection.
ggc() {