This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitconfig
90 lines (65 loc) · 2.9 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
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit --date=local
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
who = log --graph -10 --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(65,trunc)%s (%cN, %cr) %Cred%d' --date-order
# View the current working tree status using the short format
s = status
# 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"
# Pull in remote changes for the current repository and all its submodules
p = !"git pull;"
# Clone a repository including all submodules
c = clone
# Commit all changes
ca = !git add -A && git commit -av
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Push branch to origin and set up tracking of remote branch
po = "!f() { git push origin -u \"$1\"; }; f"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
br = branch
lbr = branch -l
remotes = remote -v
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Remove the old tag with this name and tag the latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# List contributors with number of commits
contributors = shortlog --summary --numbered
# Stashes and aborting
stashes = stash list
unstage = reset -q HEAD --
discard = checkout --
# Reverting
uncommit = reset --mixed HEAD~
# Precommit
precommit = diff --cached --diff-algorithm=minimal -w
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = true
[push]
default = simple
[core]
autocrlf = input