-
Notifications
You must be signed in to change notification settings - Fork 3
/
gitconfig
executable file
·153 lines (143 loc) · 5.64 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
[user]
name = user-name
email = user-email
[core]
excludesfile = userdirectory/.gitignore
editor = vim -c 'set ft=diff'
whitespace = fix
[apply]
whitespace = nowarn
[color]
branch = auto
diff = auto
interactive = auto
status = auto
ui = auto
[mirror]
summary = true
[color "diff"]
new = yellow
[status]
submodulesummary = true
[github]
user = github-user
token = github-token
[push]
# simple = like upstream with an added safety to refuse to push if the
# upstream branch’s name is different from the local one
# upstream = push the current branch back to the branch whose changes are
# usually integrated into the current branch (which is called
# `@{upstream}`)
default = simple
[pull]
rebase = true
[merge]
summary = true
tool = smerge
[diff]
tool = smerge
[mergetool "smerge"]
cmd = smerge mergetool "$BASE" "$LOCAL" "$REMOTE" "$MERGED" -o "$MERGED"
trustExitCode = true
[difftool "smerge"]
cmd = smerge mergetool "$BASE" "$LOCAL" "$REMOTE"
[mergetool]
keepBackup = false
[credential]
helper = osxkeychain
[filter "ascr"]
clean = git-ascr-filter --clean %f
smudge = git-ascr-filter --smudge %f
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[hub]
protocol = ssh
[alias]
t = status
a = add -p # Adds changes chunk-by-chunk. Very handy.
aa = add -A # Adds all changes.
co = checkout
cob = checkout -b # Creates a new branch at the current location (e.g. `git cob new-branch`).
cop = checkout -p # Resets changes chunk-by-chunk. Also very handy. (To instead reset file
# changes, you can use `git co -- file1 folder2`, or `git co -- .` to reset
# them all.)
cm = commit -m # Commit with message, e.g. `git cm "Whitespace fixes"`
ca = commit --amend # Instead of making a new commit, updates the last commit.
cma = commit --all -m
rh = reset HEAD # Resets changes you've staged with `git add`.
# (This won't touch the files, and is very safe.)
p = push
l = pull
d = diff
f = fetch --prune # Fetches remote branches, and removes deleted remote branches.
# Display with `git lg`, a prettier version of `git log` that shows branches.
# Highly recommended for knowing what's going on with the history.
lg = log --graph --all --pretty=format':%C(yellow)%h%Cred%d%Creset %s %C(white) %an, %ar%Creset'
# Branch management
pu = ! git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
# Pushes (and sets upstream) to a branch with the same name. Very handy for new branches.
db = branch -d
# Deletes a local branch. This will not let you delete a branch that isn't merged - in that case
# you'll need `fdb` defined below.
# Scary branch management
fp = push --force
# 'Force push' overrides the remote branch. Take care with this one! Useful after rebasing.
fdb = branch -D
# Forcibly deletes a branch (e.g. `git fdb old-branch`). You can usually find it again with `git
# reflog` if you notice quickly you made a mistake.
dbf = branch -D
mb = branch -f
# Forcibly moves a branch to the current location. Useful if you e.g. have origin/master checked
# out, and want to move a branch there. Will lose the old branch!
# Merge things
mt = mergetool
dt = difftool
m = merge --no-ff
# Merges in another branch. Always creates a merge commit.
ff = merge --ff-only
# Fast-forwards to another branch. Will not merge or rebase. (e.g. `git ff origin/master` will
# move your branch forward to match origin/master.)
ffm = merge --ff-only origin/master # Specialized to origin/master.
# Rebase things
rb = rebase --preserve-merges
# The default way to move your commits on top of another branch.
rbm = rebase --preserve-merges origin/master
# Specialized to moving your changes on top of origin/master.
rbi = rebase -i
# An interactive rebase which lets you choose which commits to apply, and in which order.
# Very powerful.
rbmi = rebase -i origin/master
# Specialized to moving on top of origin/master.
rbim = rebase -i origin/master
cont = rebase --continue
abort = rebase --abort
# Working tree management
pop = stash pop
# Pretty unsafe
rhard = reset HEAD --hard # Nukes all changes and resets everything to the current commit.
rhard1 = reset HEAD~1 --hard # Nukes everything and moves to the previous commit.
rhard2 = reset HEAD~2 --hard # Nukes everything and moves to the previous previous commit.
fcl = clean --force
# Deletes all untracked files (that aren't gitignored). Useful when you have junk lying around.
fcld = clean --force -d
# Deletes all untracked files and directories (that aren't gitignored). Irrecoverably.
ignore-unsafe = update-index --assume-unchanged
# Stops tracking changes to a file. Use with care.
# Submodules
su = submodule update --init --recursive
# Updates submodules, should you forced into that little corner of hell.
ll = ! git pull && git submodule update --recursive
# Pulls and updates submodules. (Does not initiliaze new ones.)
# Misc things
po = push origin
# To delete a branch, `git push origin :branch`, i.e. `git po :branch`.
com = checkout master
coom = checkout origin/master
cg = config --global # Easily access global git configuration =)
cge = config --global --edit
mom = ! git checkout origin/master && git branch -f master && git checkout master
# "Move to origin/master" - moves the master branch there and checks it out.
# vi:filetype=conf