diff --git a/.README.md b/.README.md index 6ee33fa..b5c82b1 100644 --- a/.README.md +++ b/.README.md @@ -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 `|Git patch create. +`gp `|Git patch (apply). `ga`|Git add with preview. `gr [COUNT]`|Git rebase. 2 last commits by default. 0 means from root. `gu `|Configure git user as Dmitry Voronin with specified email (project). diff --git a/.config/bash/module/git.sh b/.config/bash/module/git.sh index ad9466e..a7bb5aa 100644 --- a/.config/bash/module/git.sh +++ b/.config/bash/module/git.sh @@ -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 +gpc() { + git diff > "${@}" +} + +# Git patch (apply). +# Usage: gp +gp() { + git apply "${@}" +} # Run git garbage collection. ggc() {