-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitconfig.aliases
75 lines (75 loc) · 3.61 KB
/
.gitconfig.aliases
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
[alias]
a = add
ain = add --intent-to-add
aliases = config --get-regexp alias
ap = a -p
br = branch # classic abbrev
brd = "!f() { base=$(git branch -r --list origin/main origin/master | grep -m 1 -E 'origin/(main|master)' | xargs); git d \"$base...\" \"$@\"; }; f" # diff showing contributions of this branch (or PR) to master
brl = "!f() { base=$(git branch -r --list origin/main origin/master | grep -m 1 -E 'origin/(main|master)' | xargs); git l \"$base..\" \"$@\"; }; f" # log commits of this branch (or PR) that are not in master
c = commit
ca = c --amend
can = ca --no-edit
cf = config
ci = c # classic abbrev
cle = clean
cleanup = "!git branch --merged | grep -v '^\\*\\|master\\|main\\|develop\\|hotfix\\|temp\\|[0-9]task' | xargs -n 1 git branch -d"
cleanup-all = "!f(){ git branch | grep -v 'master\\|main\\|develop\\|hotfix\\|temp\\|[0-9]task' | grep -v ^* | sh -c 'while read br; do git log -1 $br; git branch -D $br >> ~/temp/cleaned-branches.txt; done'; }; f"
cli = cle -i
clo = clone
co = checkout # classic abbrev, note that most of the time, you should use restore or switch instead of checkout
cur = symbolic-ref --short HEAD
d = diff
ds = d --staged
dt = difftool # classic abbrev
f = fetch
fa = forgit add # not for yadm
fbd = forgit branch_delete
fcc = forgit checkout_commit
fcf = forgit checkout_file
fco = forgit checkout_branch
fcp = forgit cherry_pick
fd = forgit diff
fd = forgit diff
flo = forgit log
fm = "!if [[ $(git rev-parse --abbrev-ref HEAD) == 'main' ]]; then git fetch --no-tags origin main; else git fetch --no-tags origin $(git rev-parse --abbrev-ref HEAD) main:main; fi" # fetch only current branch and main
fms = "!if [[ $(git rev-parse --abbrev-ref HEAD) == 'master' ]]; then git fetch --no-tags origin master; else git fetch --no-tags origin $(git rev-parse --abbrev-ref HEAD) master:master; fi"
frb = forgit rebase
frc = forgit revert_commit
frh = forgit reset_head #unstage
frl = forgit reflog
fsp = forgit stash_push # not for yadm
fss = forgit stash_show
g = grep
in = lo ..@{u}
l = log
last = log -1 HEAD
lo = l --graph # classic abbrev
logp = log -p --format='commit %C(yellow)%h %C(magenta)%<(15,trunc)%an %C(cyan)%cd %C(auto)%d%Creset %s' # logp and reflogp have been adjusted so that they are compatible with git-delta
lol = lo --all # classic abbrev
m = merge
mt = mergetool # classic abbrev
out = lo @{u}..
p = pull
pc = "!git push && gh cws"
po = "!git pull --no-tags origin $(git symbolic-ref --short HEAD)" # pull only current branch, fetch nothing else
puff = push --force-if-includes --force-with-lease
pw = "!git push && sleep 10 && gh rw"
q = push
r = restore
rb = rebase
reflogp = reflog -p --format='commit %C(auto)%h%d %gd: %gs (%s)' # logp and reflogp have been adjusted so that they are compatible with git-delta
rem = remote
rl = reflog
s = stash
sh = show
st = status # classic abbrev
stash-rename = "!_() { if [ -z \"$1\" ] || [ -z \"$2\" ]; then echo \"git rename-stash 0 NewName\" && echo \"\" && git stash list && exit 1; else stash=\"stash@{$1}\"; rev=$(git rev-parse \"${stash}\"); git stash drop \"${stash}\" || exit 1; git stash store -m \"$2\" \"$rev\" || exit 1; git stash list; fi }; _"
stb = st -sb
sts = st -s
sw = switch
t = tag
u = update-index
unchange-assumed = !git ls-files -v | grep "^[[:lower:]]"
unstage = restore --staged
w = worktree
worktree-skipped = !git ls-files -v | grep "^S"