|
1 | 1 | [alias] |
2 | 2 |
|
3 | | - # View abbreviated SHA, description, and history graph of the latest 20 commits |
| 3 | + # View abbreviated SHA, description, and history graph of the latest 20 commits. |
4 | 4 | l = log --pretty=oneline -n 20 --graph --abbrev-commit |
5 | 5 |
|
6 | | - # View the current working tree status using the short format |
| 6 | + # View the current working tree status using the short format. |
7 | 7 | s = status -s |
8 | 8 |
|
9 | | - # Show the diff between the latest commit and the current state |
| 9 | + # Show the diff between the latest commit and the current state. |
10 | 10 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" |
11 | 11 |
|
12 | | - # `git di $number` shows the diff between the state `$number` revisions ago and the current state |
| 12 | + # `git di $number` shows the diff between the state `$number` revisions ago and the current state. |
13 | 13 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" |
14 | 14 |
|
15 | | - # Pull in remote changes for the current repository and all its submodules |
16 | | - p = git pull --recurse-submodules |
| 15 | + # Pull in remote changes for the current repository and all its submodules. |
| 16 | + p = pull --recurse-submodules |
17 | 17 |
|
18 | | - # Clone a repository including all submodules |
| 18 | + # Clone a repository including all submodules. |
19 | 19 | c = clone --recursive |
20 | 20 |
|
21 | | - # Commit all changes |
| 21 | + # Commit all changes. |
22 | 22 | ca = !git add -A && git commit -av |
23 | 23 |
|
24 | | - # Switch to a branch, creating it if necessary |
| 24 | + # Switch to a branch, creating it if necessary. |
25 | 25 | go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" |
26 | 26 |
|
27 | 27 | # Show verbose output about tags, branches or remotes |
28 | 28 | tags = tag -l |
29 | | - branches = branch -a |
30 | | - remotes = remote -v |
| 29 | + branches = branch --all |
| 30 | + remotes = remote --verbose |
31 | 31 |
|
32 | | - # List aliases |
| 32 | + # List aliases. |
33 | 33 | aliases = config --get-regexp alias |
34 | 34 |
|
35 | | - # Amend the currently staged files to the latest commit |
| 35 | + # Amend the currently staged files to the latest commit. |
36 | 36 | amend = commit --amend --reuse-message=HEAD |
37 | 37 |
|
38 | | - # Credit an author on the latest commit |
| 38 | + # Credit an author on the latest commit. |
39 | 39 | credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" |
40 | 40 |
|
41 | | - # Interactive rebase with the given number of latest commits |
| 41 | + # Interactive rebase with the given number of latest commits. |
42 | 42 | reb = "!r() { git rebase -i HEAD~$1; }; r" |
43 | 43 |
|
44 | 44 | # Remove the old tag with this name and tag the latest commit with it. |
|
56 | 56 | # Find commits by commit message |
57 | 57 | fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" |
58 | 58 |
|
59 | | - # Remove branches that have already been merged with master |
| 59 | + # Remove branches that have already been merged with main. |
60 | 60 | # a.k.a. ‘delete merged’ |
61 | 61 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" |
62 | 62 |
|
63 | | - # List contributors with number of commits |
| 63 | + # List contributors with number of commits. |
64 | 64 | contributors = shortlog --summary --numbered |
65 | 65 |
|
66 | | - # Merge GitHub pull request on top of the current branch or, |
67 | | - # if a branch name is specified, on top of the specified branch |
68 | | - mpr = "!f() { \ |
69 | | - declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \ |
70 | | - declare branch=\"${2:-$currentBranch}\"; \ |
71 | | - if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ |
72 | | - git fetch origin refs/pull/$1/head:pr/$1 && \ |
73 | | - git checkout -B $branch && \ |
74 | | - git rebase $branch pr/$1 && \ |
75 | | - git checkout -B $branch && \ |
76 | | - git merge pr/$1 && \ |
77 | | - git branch -D pr/$1 && \ |
78 | | - git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ |
79 | | - fi \ |
80 | | - }; f" |
| 66 | + # Show the user email for the current repository. |
| 67 | + whoami = config user.email |
81 | 68 |
|
82 | 69 | [apply] |
83 | 70 |
|
84 | | - # Detect whitespace errors when applying a patch |
| 71 | + # Detect whitespace errors when applying a patch. |
85 | 72 | whitespace = fix |
86 | 73 |
|
| 74 | +[branch] |
| 75 | + |
| 76 | + # Show most recently changed branches first. |
| 77 | + sort = -committerdate |
| 78 | + |
87 | 79 | [core] |
88 | 80 |
|
89 | | - # Use custom `.gitignore` and `.gitattributes` |
| 81 | + # Use custom `.gitignore` and `.gitattributes`. |
90 | 82 | excludesfile = ~/.gitignore |
91 | 83 | attributesfile = ~/.gitattributes |
92 | 84 |
|
93 | | - # Treat spaces before tabs and all kinds of trailing whitespace as an error |
| 85 | + # Treat spaces before tabs and all kinds of trailing whitespace as an error. |
94 | 86 | # [default] trailing-space: looks for spaces at the end of a line |
95 | 87 | # [default] space-before-tab: looks for spaces before tabs at the beginning of a line |
96 | 88 | whitespace = space-before-tab,-indent-with-non-tab,trailing-space |
97 | 89 |
|
98 | | - # Make `git rebase` safer on macOS |
| 90 | + # Make `git rebase` safer on macOS. |
99 | 91 | # More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
100 | 92 | trustctime = false |
101 | 93 |
|
|
139 | 131 |
|
140 | 132 | [diff] |
141 | 133 |
|
142 | | - # Detect copies as well as renames |
| 134 | + # Detect copies as well as renames. |
143 | 135 | renames = copies |
144 | 136 |
|
145 | 137 | [diff "bin"] |
146 | 138 |
|
147 | | - # Use `hexdump` to diff binary files |
| 139 | + # Use `hexdump` to diff binary files. |
148 | 140 | textconv = hexdump -v -C |
149 | 141 |
|
150 | 142 | [help] |
151 | 143 |
|
152 | | - # Automatically correct and execute mistyped commands |
| 144 | + # Automatically correct and execute mistyped commands. |
153 | 145 | autocorrect = 1 |
154 | 146 |
|
155 | 147 | [merge] |
|
185 | 177 | [url "git://gist.github.com/"] |
186 | 178 |
|
187 | 179 | insteadOf = "gist:" |
| 180 | + |
| 181 | +[init] |
| 182 | + |
| 183 | + templateDir = ~/.config/git/template/ |
0 commit comments