-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitconfig
More file actions
130 lines (116 loc) · 4.2 KB
/
gitconfig
File metadata and controls
130 lines (116 loc) · 4.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
[color]
status = auto
branch = auto
[core]
excludesfile = ~/.gitignore
autocrlf = input
safecrlf = false
[status]
submoduleSummary = true
[diff]
compactionHeuristic = true
[push]
default = simple
[pull]
rebase = merges
[commit]
gpgsign = true
[branch]
autosetupmerge = always
[alias]
# Basic Shortcuts
# ---------------
st = status -sb # Smarter status - include tag and branch info
cp = cherry-pick
cl = clone
co = checkout
cob = checkout -b
br = branch
a = add
aa = add --all
A = add -A
au = add -u
pu = push -u
p = push -u
pnv = push -u --no-verify
# Merge Helpers
# -------------
m = merge
mr = merge --no-edit
md = "!git merge $1 && git branch -d $1; #"
mD = "!git merge $1 && git branch -D $1; #"
mdp = "!git merge @{-1} && git branch -d @{-1}; #"
mDp = "!git merge @{-1} && git branch -D @{-1}; #"
# Reset Helpers
# -------------
r = reset
unstage = reset HEAD
uncommit = reset --soft HEAD~1
undo = checkout HEAD --
undoall = checkout -f
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# Commit Shortcuts
# ---------------
c = commit
cnv = commit --no-verify
cs = commit -S
csnv = commit -S --no-verify
cr = commit -eF .git/COMMIT_EDITMSG # If commit fails either due to a failed gpg or whatever, use the last message written when commiting again
# Diff Shortcuts
# ---------------
diff = diff --word-diff
d = diff --word-diff
dc = diff --cached
ds = diff --staged # git ds - Diff your staged changes == review before committing.
# Stash Shortcuts
# ---------------
s = stash
sl = stash list
sa = stash apply
sp = stash pop
ss = stash save
slst = !git stash show 'stash@{$1}'
slsd = !git stash show -p 'stash@{$1}'
ps = !git s && git pull && git sp
# Log Shortcuts
# ---------------
l = log --show-signature
ls = log --pretty=format:\"%C(yellow)%h %C(blue)%ad%C(red)%d %C(reset)%s%C(green) [%cn]\" --decorate --date=short # Pretty one-line log with tags, branches and authors
lsv = !git ls --numstat # A verbose ls, shows changed files too
sig = !git ls --show-signature -1 # Check for GPG signatures
lh = log --graph
la = !git lh --date-order --all 2> /dev/null
lb = log --graph --simplify-by-decoration
lba = !git lb --all
lme = !git ls --author=\"$(git config --get user.email)\" --no-merges
lod = "!f() { git lme --after=\"$1 0:00\" --before=\"$1 23:59\"; }; f"
lsd = "!f() { git lme --since=\"$1\"; }; f"
yesterday = !git lsd '1 day ago' # Know what you did yesterday
today = !git lod today
# External Commands
# -----------------
# Generate a .gitignore based on given arguments ( For list of arguments do: gi list )
# e.g.: git ignore osx, php, node, wordpress >> .gitignore
ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi"
# Open all conflicted files in the default editor
fix = "!$EDITOR `git diff --name-only | uniq`"
# Set the user profile to be used when commiting by using the gituser function defined in ~/.profile
user = "!bash -c -l \"gituser $1\""
# Open all modified tracked files within the current repo
session = "!git diff --name-only -z | xargs -0 bash -c '</dev/tty open \"$@\"' x"
sd = stash list | awk -F: '{ print "\n\n\n\n"; print $0; print "\n\n"; system("git stash show -p " $1); }'
# Copy last commit message to clipboard
cpc = !git log -1 --pretty=%B | pbcopy
# Copy todays git commit messages into one line
cptoday = !git today --oneline --no-decorate --pretty=format:%s | awk '{print $0}' ORS='. ' | pbcopy
cplod = "!f() { git lme --after=\"$1 0:00\" --before=\"$1 23:59\" --oneline --no-decorate --pretty=format:%s | awk '{print $0}' ORS='. ' | pbcopy; }; f"
cplsd = "!f() { git lme --since=\"$1\" --oneline --no-decorate --pretty=format:%s | awk '{print $0}' ORS='. ' | pbcopy; }; f"
# Edit recently modified files
edit = !vim $(git status --porcelain | awk '{print $2}')
code = !code $(git status --porcelain | awk '{print $2}')
[init]
defaultBranch = main