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

View file

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