-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitaliases
74 lines (55 loc) · 2.05 KB
/
gitaliases
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
[alias]
a = add
amd = commit --amend
b = branch
c = commit
ca = !git add -A && git commit
co = checkout
cp = cherry-pick
d = diff -- . ':!*package-lock.json' ':!*yarn.lock'
dc = diff --cached -- . ':!*package-lock.json' ':!*yarn.lock'
f = fetch
fp = push --force
l = log --branches --pretty=custom
lc = shortlog --email --numbered --summary
p = push
r = rebase
rc = rebase --continue
st = status
sth = stash --include-untracked
u = commit --amend --no-edit
up = !git fetch && git rebase --autostash FETCH_HEAD
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove branches that have already been merged with master.
dm = "!f() {\
git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Switch to a branch, creating it if necessary.
go = "!f() { \
git switch -c \"$1\" 2> /dev/null || git switch \"$1\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Interactive rebase with the given number of latest commits.
reb = "!f() { \
git rebase -i HEAD~$1; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove the tag with the specified tag name if it exists and tag the latest
# commit with that name.
retag = "!f() { \
git tag -d "$1" &> /dev/null; \
git tag $1; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove last commits (by default it removes the last commit).
rlc = "!f() { \
declare n=\"${1:-1}\"; \
git reset --hard \"HEAD~$n\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Undo last commits (by default it undoes the last commit).
ulc = "!f() { \
declare n=\"${1:-1}\"; \
git reset --soft \"HEAD~$n\"; \
}; f"