-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitconfig
executable file
·94 lines (81 loc) · 3.28 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
[user]
email = piotr@wittchen.io
name = Piotr Wittchen
[core]
autocrlf = input
editor = vim
excludesfile = ~/.gitignore_global
[push]
; push only to the current branch
default = simple
[pull]
rebase = false
[diff]
tool = vimdiff
[merge]
tool = vimdiff
conflictstyle = diff3
[mergetool]
prompt = false
[alias]
; metadata
aliases = !git config -l | grep alias | cut -c 7- | sort
url = config --get remote.origin.url
; status
status-short = status -sb
; commits, logs & branches
my-commits = "!git log --author=\"`git config user.name`\" --date=short"
my-commits-today = "!git log --author=\"`git config user.name`\" --date=short --since=00:00:00 --all --no-merges"
my-commits-last-month = "!git log --author=\"`git config user.name`\" --date=short --since=\"30 days ago\" --all --no-merges"
last-commit-msg = log -1 --pretty=%B
last-commit-hash = log -1 --pretty=%h
hist = log --graph --decorate --pretty=format:'%C(yellow)%h %Creset %C(red)%d %ad% %Creset %s %C(bold blue)[%cn]%Creset' --date=relative --abbrev-commit
list-new-unstaged-files = ls-files --others --exclude-standard
contributors = shortlog -sn
; tags
tags-by-date=tag --sort version:refname
; tracked files
tracked-files = ls-files -t
untracked-files = ls-files --others
ignored = ls-files --others -i --exclude-standard
; ignoring files locally
ignore-local = update-index --assume-unchanged
unignore-local = update-index --no-assume-unchanged
ignored-local = !git ls-files -v | grep "^[[:lower:]]"
; adding new files and reviewing changes
review = add -p
add-all = add -A
; undoing things
reset-file = checkout HEAD --
discard-uncommited-changes = reset --hard
discard-unstaged-changes = checkout -- .
remove-from-stage = reset HEAD --
undo-last-commit = reset --hard HEAD~1
revert-merge-commit = git revert -m 1
restore-file = !git checkout $(git rev-list -n 1 HEAD -- "$1")^ -- "$1"
; removing untracked files/dirs
show-untracked-files-to-remove = clean -n
remove-untracked-files = clean -f
remove-untracked-dirs = clean -fd
; merging/squashing commits
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
; branches
last-branch = checkout -
new-branch = checkout -b
delete-branch = branch -d
force-delete-branch = branch -D
delete-remote-branch = push origin --delete
delete-branches-merged-to-master = "!git checkout master && git branch --merged | grep -v '\\*' | grep -v develop | xargs -n 1 git branch -d"
delete-branches-merged-to-develop = "!git checkout develop && git branch --merged | grep -v '\\*'| grep -v master | xargs -n 1 git branch -d"
; showing diffs
diff-commit = diff --cached HEAD~1
diff-staged = diff --staged
; searching files
find-file= !git ls-files | grep -i
; interesting references for git aliases and configuration:
; - https://gist.github.com/mwhite/6887990
; - http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
; - https://gist.github.com/robmiller/6018582
; - https://github.com/git-tips/tips
; - https://gist.github.com/robmiller/5133264
; - https://github.com/qw3rtman/git-fire