forked from michel-kraemer/gitaliases
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitaliases.sh
36 lines (29 loc) · 1.37 KB
/
gitaliases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# aliases for common git commands
alias g='git'
alias st='git status'
alias push='git push'
alias commit='git commit'
alias amend='git commit --amend'
alias log='git log'
alias stash='git stash'
alias checkout='git checkout'
alias branch='git branch'
alias fetch='git fetch'
alias merge='git merge'
alias cherry-pick='git cherry-pick'
alias rebase='git rebase'
# 'git pull --rebase' with a short log of the latest changes
pull () { local HEADHASH=`git describe --always --abbrev=40`; git pull --rebase $*; echo; PAGER='cat -B' git log --format="%C(yellow)%h %C(green)%an%C(reset): %s" $HEADHASH.. | sed -nr 's/([^:]+)\:/\1\t/;p'; }
# 'git pull --ff-only' with a short log of the latest changes
ff () { local HEADHASH=`git describe --always --abbrev=40`; git pull --ff-only $*; echo; PAGER='cat -B' git log --format="%C(yellow)%h %C(green)%an%C(reset): %s" $HEADHASH.. | sed -nr 's/([^:]+)\:/\1\t/;p'; }
# verbose add
add () { git add -v $*; git status; }
# verbose reset
reset () { git reset $*; git status; }
# 'git add' with 'git ls-files' and grep
# usage like grep - example: gadd 'readme.txt'
gadd () { git ls-files -co --exclude-standard | grep $* | xargs git add -v; git status; }
# 'git reset' with 'git ls-files' and grep
greset () { git ls-files | grep $* | xargs git reset; git status; }
# Enable auto-completion for aliased 'git' command
complete -o default -o nospace -F _git g