-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
89 lines (67 loc) · 2.63 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
[alias]
# Prettier git `log`
grog = log --pretty=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)' --graph --abbrev-commit --decorate --all
# Initialize a repository and commit an empty commit
it = !git init && git commit -m "root" --allow-empty
# Add everything and commit
acm = !git add -A && git commit
# ... with a message verbatim from the CLI
acmm = "!f() { git add -A && git commit -m \"${*:-Updates $(date +%Y-%m-%d)}\"; }; f"
# Git `commit` shorthand
cm = commit
# ... with a message verbatim from the CLI
cmm = "!f() { git commit -m \"${*:-Updates $(date +%Y-%m-%d)}\"; }; f"
# Git `status` with shorthand output
st = status -bs
sti = status -bs --ignored
# Git `checkout` shorthand
co = checkout
cob = checkout -b
# `checkout` a branch from a pull request (GitHub specific?!)
copr = "!f() { git fetch ${2:-origin} pull/${1}/head:pr/${1} && git checkout pr/${1}; }; f"
# Commit files in the staging area to the last commit
commend = commit --amend --no-edit --reset-author
# Diff words & chars with colored output
wdiff = diff --color-words
cdiff = diff --color-words=.
# Stash only unstaged changes to tracked files
stsh = stash --keep-index
# Stash untracked and tracked files
staash = stash --include-untracked
# Stash ignored, untracked, and tracked files
staaash = stash --all
# Soft reset
undo = reset --soft HEAD^
# Unstage from the the staging area
unstage = reset HEAD
# Mark a file as "assume unchanged"
assume = update-index --assume-unchanged
# Reverse the above
unassume = update-index --no-assume-unchanged
# Show the files that are currently assume-unchanged
assumed = !git ls-files -v | grep ^h | cut -c 3-
# Create an annotated tag with a message for a (sem)ver release
ver = "!f() { git tag -a ${1} -m \"${1}\"; }; f"
# List contributors with number of commits
who = shortlog -sn
# List branches ordered by most recent commit (with verbose information)
brecent = branch --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a # -v for verbose
remotes = remote -v
[color]
ui = auto
[commit]
template = ~/.gitmessage
[core]
# Global .gitignore
excludesfile = ~/.gitignore.global
[include]
# Custom .gitconfig
path = ~/.gitconfig.local
[push]
default = simple
followTags = true
[status]
showUntrackedFiles = all