-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
48 lines (33 loc) · 1.46 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
[alias]
# Update repo with latest via rebase and clean up git objects
up = !git pull --rebase --prune $@
# Undo the most recent commit
undo = reset HEAD~1 --mixed
# Redo the undo
redo = reset HEAD@{1}
# Amend the currently staged files to the latest commit.
amend = commit --amend --reuse-message=HEAD
fpush = push --force-with-lease
# Shortcut for `checkout`
co = checkout
# Shortcut for `commit`
ci = commit
# Commit all changes.
ca = !git add -A && git commit -av
# Remove branches that have already been merged with main.
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# Switch to a branch, creating it if necessary.
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# View abbreviated SHA, description, and history graph of the latest 20 commits.
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status
st = status
# View the current working tree status using the short format.
s = status -s
# Show the diff between the latest commit and the current state.
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state.
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
[pull]
rebase = true