Repository navigation
Expand file tree
/
Copy pathdot_gitconfig
More file actions
123 lines (121 loc) · 5.41 KB
/
Copy pathdot_gitconfig
File metadata and controls
123 lines (121 loc) · 5.41 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Generated by ansible
[user]
email = dan@danlovesprogramming.com
name = Daniel Newman
[credential]
username = floatingman
[core]
excludesfile = /home/dnewman/.gitignore_global
[diff]
tool = nvr
guitool = meld
prompt = false
[difftool "nvr"]
cmd = nvr -s -d $LOCAL $REMOTE
[merge]
tool = nvr
guitool = meld
[mergetool "nvr"]
cmd = nvr -s -d $LOCAL $BASE $REMOTE $MERGED -c 'wincmd J | wincmd ='<Paste>
[difftool "meld"]
cmd = meld "$LOCAL" "$REMOTE"
trustexitcode = true
[mergetool "meld"]
cmd = meld --auto-merge "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
trustexitcode = true
[delta]
plus-color = "#012800"
minus-color = "#340001"
syntax-theme = 1337
features = decorations
whitespace-error-style = 22 reverse
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
[interactive]
diffFilter = delta --color-only
[alias]
# Common shortcuts I use
aa = add --all
# from trevor bramble https://twitter.com/TrevorBramble/status/774292970681937920
alias=!git config -l | grep ^alias | cut -c 7- | sort
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEADco = checkout
ci = commit
co = checkout
cob = checkout -b
# List contributors with number of commits
contributors = shortlog --summary --numbered
# counts how far behind current branch is
count = "!f() { compareBranch=${1-master}; git rev-list --count HEAD ^$compareBranch; }; f"
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# 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"
dc = diff --cached
# `git di $number` shows the diff between the stat `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# 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; git remote -v update -p"
ds = diff --staged
# guesses which email address to use for a repo
email-guess = !. ~/.local/bin/gitscripts/email-guess.sh
# 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"
# Swich to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Color graph log view
graph = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"
# Show files ignored by git
ign = ls-files -o -i --exclude-standard
# View abbreviated SHA, description, and history graphy of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
lg = log --color --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an (%G?)>%Creset' --abbrev-commit
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ls = ls-files
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# show remote urls for origin
rso = remote show origin
remote-merged = !. ~/.local/bin/gitscripts/git-remote-merged
remote-notmerged = !. ~/.local/bin/gitscripts/git-remote-notmerged
# View the current working tree status using the short format
s = status -s
st = status -sb
unpushed = log --branches --not --remotes --simplify-by-decoration --decorate --oneline
# subtree add
sba = "!f() { git subtree add --prefix $2 $1 master --squash; }; f"
# subtree update
sbu = "!f() { git subtree pull --prefix $2 $1 master --squash; }; f"
# cool trick to use for demos
next = '!git checkout `git rev-list HEAD..demo-end | tail -1`'
prev = 'checkout HEAD^'
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
top = !git log --format=format:%an | sort | uniq -c | sort -r | head -n 20
# from seth vargo https://gist.github.com/sethvargo/6b2f7b592853381690bfe3bd00947e8f
unreleased = "!f() { git fetch --tags && git diff $(git tag | tail -n 1); }; f"
unstage = reset HEAD --
up = !git pull origin master && git remote prune origin && git submodule update --init --recursive
undo = !git reset HEAD~1 --mixed
# Useful but less often used
authors = "!git log --pretty=format:%aN | sort | uniq -c | sort -rn"
today = log --stat --since=\"1 Day Ago\" --graph --pretty=oneline --abbrev-commit --date=relative
[url "git@github.com:floatingman"]
insteadOf = https://github.com/floatingman
# GitHub 401-challenges anonymous protocol-v2 git requests sent over HTTP/2,
# which makes unattended git fetches prompt for credentials. Force HTTP/1.1
# for GitHub HTTPS remotes; every other transport/protocol combination works.
[http "https://github.com/"]
version = HTTP/1.1