You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.7 KiB
109 lines
2.7 KiB
#!/bin/bash
|
|
|
|
function heck_git_ui {
|
|
# GIT BASIC UI
|
|
# ============
|
|
# clone
|
|
alias gclone='git clone --recurse-submodules'
|
|
# fetch
|
|
alias gf='git fetch --all --tags'
|
|
# pull
|
|
alias gp='git pull'
|
|
|
|
# show status
|
|
alias gs='git status --long'
|
|
# show diff of working copy vs. last commit
|
|
alias gd='git diff'
|
|
|
|
# log - show history (only active branch)
|
|
alias gl='git log --graph --date=iso --topo-order --source --oneline'
|
|
# show tags
|
|
alias gst='git for-each-ref --sort=creatordate --format "%(objectname) %(refname)" refs/tags'
|
|
# switch to branch or tag
|
|
alias gco='git checkout'
|
|
|
|
# add
|
|
alias gadd='git add'
|
|
# commit
|
|
alias gc='git commit'
|
|
|
|
# push
|
|
alias gpush='git push --tags'
|
|
|
|
|
|
|
|
# GIT EXTENDED UI
|
|
# ===============
|
|
# clone
|
|
alias gclonebare='git clone --bare'
|
|
alias gclonebaremirror='git clone --mirror'
|
|
# push
|
|
alias gpushf='git push --force'
|
|
# tag create
|
|
alias gt='git tag'
|
|
# tag delete
|
|
alias gtd='git tag --delete'
|
|
# create branch
|
|
alias gb='git branch'
|
|
# show branches
|
|
alias gsb='git branch -vv --all'
|
|
# log all branches
|
|
alias gla='gl --all'
|
|
# log long - show history long (only active branch)
|
|
alias gll='git log --graph --date=iso --stat --topo-order --source'
|
|
# log long all - show history long (all branches)
|
|
alias glla='gll --all'
|
|
# merge
|
|
alias gm='git merge --no-ff'
|
|
# rebase
|
|
alias grb='git rebase'
|
|
# cherry-pick
|
|
alias gcp='git cherry-pick'
|
|
# clean - remove untracked files
|
|
alias gclean='git clean -dxf'
|
|
|
|
## REMOTES
|
|
# show remote
|
|
alias grs='git remote --verbose'
|
|
# add remote
|
|
alias gra='git remote add'
|
|
# delete remote
|
|
alias grd='git remote delete'
|
|
|
|
# stats - commits by author
|
|
alias gstats='git shortlog -sne'
|
|
|
|
# stats - lines of code by author
|
|
function gstatslines() {
|
|
echo -e "this usually takes a while.\nSo, go grab a coffee... or two... or three..."
|
|
git ls-files | while read f; do {
|
|
git blame -wMCC --line-porcelain $f | grep -I '^author '
|
|
}; done | sort -f | uniq -ic | sort -n --reverse
|
|
}
|
|
|
|
# stats - commits and lines of code
|
|
alias gstatsall='gstats;gstatslines'
|
|
|
|
# submodule
|
|
alias gsub='git submodule'
|
|
alias gsublist='git submodule status'
|
|
alias gsublistall='git submodule status --recursive'
|
|
alias gsubinit='git submodule update --init'
|
|
alias gsubpush='git submodule foreach "git push || :"'
|
|
alias gsubupdate='git submodule update --recursive --remote'
|
|
|
|
function heck_git_ui_deprecated {
|
|
# --all / -u
|
|
alias gpau='gpush --all -u'
|
|
alias gpu='gpush -u'
|
|
alias gpauf='gpushf --all -u'
|
|
alias gpuf='gpushf -u'
|
|
# with tags
|
|
alias gpaut='gpush --all -u;gpusht'
|
|
alias gput='gpush -u;gpusht'
|
|
alias gpauft='gpushf --all -u;gpushtf'
|
|
alias gpuft='gpushf -u;gpushtf'
|
|
}
|
|
}
|
|
|
|
heck_git_ui
|