-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
110 lines (88 loc) · 3.79 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
[advice]
# do not inform about commits skipped during an interactive rebase
skippedCherryPicks = false
[alias]
# list all aliases
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
# add
a = add # add
aa = add . # add all
au = add -u . # only add changed
# via http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
snapshots = !git stash list --grep snapshot
# branch
b = branch -v # branch (verbose)
prune-gone = !git b -vv | grep gone | awk '{print $1}' | xargs -r git b -d # remove local orphan branches
# commit
c = commit -m # commit with message
ca = commit -am # commit all with message
ci = commit # commit
amende = commit --amend # amend your last commit
amend = commit --amend --no-edit # amend your last commit without editing commit message
wip = !git add . && git commit -am 'wip' --no-verify # temporary commit with skipped pre-hooks
fix = commit --fixup # fixup to a specified commit
fixr = !sh -c 'sha=$(git rev-parse $1) && git commit --fixup $sha && git rebase -i $sha~' - # fixup to a specified commit and immediately rebase
# checkout
co = checkout # checkout
nb = checkout -b # create and switch to a new branch (mnemonic: "git new branch branchname...")
cop = !sh -c 'git branch | (which fzf &> /dev/null && (fzf || :) || grep $1) | xargs -r git checkout' - # changes local branches on partial branch name match
# cherry-pick
cp = cherry-pick # grab a change from a branch
# diff
d = diff # diff unstaged changes
dc = diff --cached # diff staged changes
# fetch
fe = fetch -p --all # feth from all remotes, remove local branches that where removed remotely
# log
l = log --graph --abbrev-commit
changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status
short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
simple = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
# pull
pl = pull --ff-only # pull; do not try to merge, fail if fast-forward is not possible
# push
ps = push # push
psf = push --force-with-lease
psn = push -u origin HEAD # push current branch to origin and set it as an upstream
# rebase
rb = rebase # rebase
rbi = rebase -i # start interactive rebase
rbc = rebase --continue # continue interactive rebase
# remote
r = remote -v # show remotes (verbose)
# status
s = status -s # status
[branch]
# sort branches by last commit date
sort = -committerdate
[core]
excludesfile = ~/.gitignore
editor = vi
pager = less -FXR # use default flags for less even if $LESS env var is set
[color]
ui = true
[diff]
# Git diff will use (i)ndex, (w)ork tree, (c)ommit and (o)bject
# instead of a/b/c/d as prefixes for patches
mnemonicprefix = true
algorithm = patience
[init]
defaultBranch = master
[push]
# 'git push' assumes --set-upstream
autoSetupRemote = true
# 'git push' will push the current branch to its tracking branch
# the usual default is to push all branches
default = upstream
[rebase]
# stashes all the changes before performing a rebase, then applies
# it back after rebase is finished
autostash = true
# during an interactive rebase moves commits made with --fixup and --squash
# to the corresponding targets
autosquash = true
[user]
name = Roman Usherenko
email = [email protected]