-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitconfig
134 lines (116 loc) · 3.83 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
[user]
name = Nicholas Glazer
email = glazer.nicholas@gmail.com
[github]
user = NicholasGlazer
[alias]
# SHORT VERSIONS
co = checkout
cob = checkout -b
ci = commit
cnv = commit --no-verify
ss = status --short
st = status
br = branch -v
df = diff
rb = rebase
la = "!git config -l | grep alias | cut -c 7-"
# show what I did today
day = "!sh -c 'git log --reverse --no-merges --branches=* --date=local --after=\"yesterday 11:59PM\" --author=\"`git config --get user.name`\"'"
# Remove changes from index
unstage = reset HEAD --
# Revert changes
restore = checkout --
# Colored history view
hist = log --color --pretty=format:\"%C(yellow)%h%C(reset) %s%C(bold red)%d%C(reset) %C(green)%ad%C(reset) %C(blue)[%an]%C(reset)\" --relative-date --decorate
# show a pretty log graph
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
# show number of commits per contributer, sorted
count = shortlog -sn --all
# current branch
cbr = rev-parse --abbrev-ref HEAD
undo = reset --soft HEAD~1
amend = commit -a --amend
# OPENTHE GITHUB PAGE FOR THE...
# ...repo homepage (included for consistency)
open = !hub browse --
# ...repo commits
opencommits = !hub browse -- commits
# ...commit page for HEAD
openhead = !hub browse -- commit/$(git rev-parse HEAD)
# ...commit page for a passed SHA (defaults to HEAD)
opencommit = "!f() { sha=$(git rev-parse ${1:-HEAD}); hub browse -- commit/$sha; }; f"
# ...blame page for the passed file (a line number/range can be passed in too)
openblame = "!f() { sha=$(git log --format='%h' -1 $1); hub browse -- blame/$sha/$1#L$2; }; f"
# ...commit history page for the passed file
openhistory = "!f() { sha=$(git log --format='%h' -1 $1); hub browse -- commits/$sha/$1; }; f"
# ...pull request page for current branch (if one exists)
openpr = "!f() { url=$(github_pr_url); open $url; }; f"
# ...repo issues
issues = !hub browse -- issues
# ...repo pull requests
pulls = !hub browse -- pulls
# ...repo wiki
wiki = !hub browse -- wiki
# ...repo settings
settings = !hub browse -- settings
# ...repo branches
branches = !hub browse -- branches
# ...repo branches
releases = !hub browse -- releases
# GET THE URL FOR...
# ...HEAD
headurl = "!hub browse -u -- commit/$(git rev-parse HEAD)"
# ...HEAD (into clipboard)
copyheadurl = "!git headurl | pbcopy"
# ...A given commit
url = "!f() { sha=$(git rev-parse ${1:-HEAD}); hub browse -u -- commit/$sha; }; f"
# ...A given commit (into clipboard)
copyurl = "!git url $1 | pbcopy"
# PRINT OUT THE...
# ...SHA of HEAD
headsha = rev-parse HEAD
# ...the current branchname
branchname = !git rev-parse --abbrev-ref HEAD
# ...incoming commits
incoming = !git hist ..origin/$(git branchname)
# ...outgoing commits
outgoing = !git hist origin/$(git branchname)..
# UTILITIES TO...
# ...delete merged branches
cleanup = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# ...open GUI
visualise = !gitk
# ...push current branch to origin and set as a tracking branch
publish = !git push -u origin $(git branchname)
# ...delete remote branch
unpublish = !git push -u origin :$(git branchname)
# ...push a branch and create a pull request
pr = !git publish && hub pull-request
# ...commit everything as a WIP commit
wip = commit -am wip
# ...reset last commit (used after 'git wip')
pop = reset head^
[init]
defaultBranch = main
[apply]
whitespace = nowarn
[core]
excludesfile = ~/.gitignore_global
[credential]
editor = nvim
[grep]
extendRegexp = true
lineNumber = true
[help]
autocorrect = 1
[pager]
diff =
color = true
[push]
# push will only do the current branch, not all branches
default = current
[rebase]
instructionFormat = "[%an - %ar] %s"
[status]
color = true