-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.gitconfig
More file actions
134 lines (111 loc) · 5.2 KB
/
.gitconfig
File metadata and controls
134 lines (111 loc) · 5.2 KB
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 = voitd
email = dimytr.voitenko@gmail.com
[core]
editor = nvim
excludesfile = ~/.global_gitignore
[commit]
template = /Users/void/comtemp
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[alias]
amend = commit --amend --reuse-message=HEAD
undo = reset HEAD~1 --mixed
; clone = clone --template=/Users/void/.git-templates
# push
pf = push --force-with-lease
a = "!git status --short | peco | awk '{print $2}' | xargs git add"
b = branch -a
sw = checkout -
# rebase
r = rebase
ri = rebase --interactive
rc = rebase --continue # continue rebase
rs = rebase --skip # skip rebase
ra = rebase --abort
m = merge
ma = merge --abort
mc = merge --continue
ms = merge --skip
rmc = rm --cached
ls = ls-files
lsf = !git ls-files | grep -i
ph = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
pu = "!git pull --rebase origin $(git rev-parse --abbrev-ref HEAD)"
# ecf: edit conflicted files
ecf = !nvim -p `git ls-files --unmerged | cut -f2 | sort -u`
# add conflicted file on merge
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
# open repo in browser
open ="!hub browse"
# show url of remote
url =! bash -c 'git config --get remote.origin.url | sed -E "s/.+:\\(.+\\)\\.git$/https:\\\\/\\\\/github\\\\.com\\\\/\\\\1/g"'
# View the current working tree status using the short format
st = status --short --branch
ss = stash save
sc = stash clear
sl = !git stash list | awk -F':' '{print $1}' | fzf --preview 'git -c color.ui=always stash show -p {}'
sp = !git stash pop `git stash list | awk -F':' '{print $1}' | fzf --preview 'git -c color.ui=always stash show -p {}'`
sd = !git stash drop `git stash list | awk -F':' '{print $1}' | fzf --preview 'git -c color.ui=always stash show -p {}'`
fixup = "!f() { SHA=`git rev-parse "$1"`; git commit --fixup "$SHA" && GIT_SEQUENCE_EDITOR=true git rebase --interactive --autosquash "$SHA^"; }; f"
changelog = "!_() { t=$(git describe --abbrev=0 --tags); git log ${t}..HEAD --no-merges --pretty=format:'* %s'; }; _"
# list files which have changed since REVIEW_BASE
# (REVIEW_BASE defaults to 'master' in my zshrc)
files = !git diff --name-only $(git merge-base HEAD \"$REVIEW_BASE\")
# Open all files changed since REVIEW_BASE in Vim tabs
# Then, run fugitive's :Gdiff in each tab, and finally
# tell vim-gitgutter to show +/- for changes since REVIEW_BASE
review = !nvim -p $(git files) +\"tabdo Gvdiffsplit! $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
# Same as the above, except specify names of files as arguments,
# instead of opening all files:
# git reviewone foo.js bar.js
reviewone = !nvim -p +\"tabdo Gvdiffsplit! $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
# Interactive rebase with the given number of latest commits
rebase-branch = "!r() { git rebase -i HEAD~$1; }; r"
# respond to PR feedback
pr =!git commit --amend --reuse-message=HEAD --no-edit && git push --force-with-lease
# interactive sync your current branch with master
sync = !git fetch origin && git rebase --interactive origin/master
# interactive sync your current branch with master
syncu = !git fetch upstream && git rebase --interactive upstream/master
# Pull in remote changes for the current repository and all its submodules
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Checkout a pull request from origin (of a github repository)
f = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr"
unpushed = log --branches --not --remotes --no-walk --decorate --oneline
conflicts = diff --name-only --diff-filter=U
# nice logs
lg = log --color --graph --pretty=format:'%C(yellow)%h%Creset %s %C(bold green)%ar%Creset %C(bold blue)%an%Creset%C(bold red)%d%Creset' -n 16
lines = ! git ls-files | xargs cat | wc -l
# requires FZF
autofixup = "!f() { COMMIT=$(git log --pretty=oneline | fzf | awk '{print $1}'); git commit --fixup $COMMIT; GIT_SEQUENCE_EDITOR=: git rebase --autostash --autosquash -i $COMMIT^; }; f"
# commit all with an message (which need not be quoted)
cm = "!f() { git commit -a -m \"$*\" ; }; f"
save = "!git add -A && git commit -m 'SAVEPOINT'"
wipe = "!git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard"
# fix your branch when it's missing upstream
upstream = "!git branch --set-upstream-to=origin/$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --abbrev-ref HEAD)"
# List aliases
aliases = config --get-regexp alias
[url "git@github.com:"]
insteadOf = git://github.com/
insteadOf = gh:
insteadOf = github:
[push]
default = current
[core]
excludesfile = /Users/void/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true