-
Notifications
You must be signed in to change notification settings - Fork 0
/
_gitconfig
85 lines (66 loc) · 3.84 KB
/
_gitconfig
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[core]
logallrefupdates = true
ignorecase = true
autocrlf = false
pager = cat
editor = vim
[gui]
wmstate = zoomed
geometry = 876x451+249+102 194 203
[alias]
# synonyms and shortcuts
wc = whatchanged
st = status
stat = status
branches = branch
switch = checkout
# list files affected by a sha-1
# Usage: git files ff1234 => [M] Foo.txt, [A] Bar.txt
files = "!f() { git diff --name-status $1^ $1; }; f"
# retire a branch (prepend "zzz-" to the name)
# Usage: git retire rames-feature-foo
retire = "!g() { git branch -m $1 zzz-$1; }; g"
# make sure the "master" branch is up to date with remotes/trunk
# Usage: git remaster (when not on branch "master")
remaster = "!h() { git svn fetch ; git branch -d master ; git checkout -b master remotes/trunk; }; h"
# throw away file contents from working directory and revert to history
# Usage: git junk foo.txt => foo.txt is reset to before editing state
junk = checkout --
# useful options for investigating commits from multiple branches
# Usage: git history remotes/v_1.2.3 remotes/v_1.2.4 ... see commit log interspersed for both
history = show-branch --more=3 --date-order
# useful options for investigating commits from multiple branches
# Usage: git history remotes/v_1.2.3 remotes/v_1.2.4 ... see commit log interspersed for both
feature = "!i() { git checkout rames-feature-$1 ; }; i"
# better preview of "git svn dcommit -n" including log messages and file modification status for each commit
# Usage: git changes => when on a branch that is downstream from an SVN branch
changes = "!j() { git svn dcommit -n | awk -- 'FNR > 1 {print $3}' | xargs -n 1 -I{} bash -c 'git log --oneline {}~1..{} && git diff --name-status {}^ {}'; git status | head -1 ; git svn dcommit -n | head -1 ; }; j"
# don't show branches with "zzz" in them (retired branches)
# Usage: git br
br = "!f() { git branch | grep -v zzz | grep -v '\\*'; }; f"
# Usage: git rb
# show only remote branches (remotes/*...)
rb = "!f() { git branch -a | grep '^ remote' | grep -v '\\*'; }; f"
# show "bug-like" commits in the last two weeks
# Usage: git bugs
bugs = "!f() { git log --since='2 weeks ago' --pretty=format:'%Cgreen%h%Creset %Cred%an%Creset %s%n' --color | grep 'bug\\|bugs'; }; f"
# show oneline commits in last two weeks, but also include author information
# Usage: git oneline
oneline = "!f() { git log --since='2 weeks ago' --pretty=format:'%Cgreen%h%Creset %Cred%an%Creset %s' --color; }; f"
# [G]it.[R]ecently.[A]dded.[F]iles (graf)
# Usage: git graf
graf = "!f() { git diff --name-status `git log --since='2 weeks ago' --pretty=format:'%H' | tail -1 ` HEAD | grep ^A ; }; f"
# Usage: git blamestat [file]
# Who recently changed lines in a file and when they were changed
blamestat = "!f() { echo Blaming $1: ; echo '' > /tmp/out-dates.txt ; git blame -f $1 | awk -- '{print $4}' | sort | uniq -c >> /tmp/out-dates.txt ; echo '' > /tmp/out-people.txt ; git blame -f $1 | awk -- '{print $3}' | sed 's/(//g' | sort | uniq -c | sort -n >> /tmp/out-people.txt ; paste /tmp/out-dates.txt /tmp/out-people.txt ; rm /tmp/out-dates.txt /tmp/out-people.txt ; }; f"
# Usage: git cross [commit-id]
# cherry-pick the commit-id to the current branch with a default "merge" message
cross = "!f() { git cherry-pick -n $1 ; M=`git show $1 | grep git-svn-id | sed -e 's/^.*ssh//g' -e 's/^.*\\///g' -e 's/\\ .*$//g' -e 's/@/ @ /g'`; N=`git show $1 --pretty=format:%s | head -1`; J=\"merge $M =\\> $N\"; git commit -e -m \"$J\"; }; f"
# Usage: git alias
# show local aliases
alias = "!f() { cat ~/.gitconfig | grep -A1 '[U]sage:' | sed 's/^.*[U]sage:/>>>/g' | sed 's/^--//g' ; }; f"
[color]
ui = auto
[user]
name = Robert Ames
email = [email protected]