|
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; git submodule foreach git pull origin master" |
| 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. |
|
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" |
81 | | -
|
82 | | - # "Delete untracked" removes stale local branches with no tracked upstream branch |
83 | | - dut = "!f() { \ |
84 | | - git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | \ |
85 | | - awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do git branch -D $branch; done; \ |
86 | | - }; f" |
| 66 | + # Show the user email for the current repository. |
| 67 | + whoami = config user.email |
| 68 | + |
| 69 | + # "Delete untracked" removes stale local branches with no tracked upstream branch |
| 70 | + dut = "!f() { \ |
| 71 | + git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | \ |
| 72 | + awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do git branch -D $branch; done; \ |
| 73 | + }; f" |
87 | 74 |
|
88 | 75 | [apply] |
89 | 76 |
|
90 | | - # Detect whitespace errors when applying a patch |
| 77 | + # Detect whitespace errors when applying a patch. |
91 | 78 | whitespace = fix |
92 | 79 |
|
| 80 | +[branch] |
| 81 | + |
| 82 | + # Show most recently changed branches first. |
| 83 | + sort = -committerdate |
| 84 | + |
93 | 85 | [core] |
94 | 86 |
|
95 | | - # Use custom `.gitignore` and `.gitattributes` |
| 87 | + # Use custom `.gitignore` and `.gitattributes`. |
96 | 88 | excludesfile = ~/.gitignore |
97 | 89 | attributesfile = ~/.gitattributes |
98 | 90 |
|
99 | | - # Treat spaces before tabs and all kinds of trailing whitespace as an error |
| 91 | + # Treat spaces before tabs and all kinds of trailing whitespace as an error. |
100 | 92 | # [default] trailing-space: looks for spaces at the end of a line |
101 | 93 | # [default] space-before-tab: looks for spaces before tabs at the beginning of a line |
102 | 94 | whitespace = space-before-tab,-indent-with-non-tab,trailing-space |
103 | 95 |
|
104 | | - # Make `git rebase` safer on macOS |
| 96 | + # Make `git rebase` safer on macOS. |
105 | 97 | # More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
106 | 98 | trustctime = false |
107 | 99 |
|
|
141 | 133 | [commit] |
142 | 134 |
|
143 | 135 | # https://help.github.com/articles/signing-commits-using-gpg/ |
144 | | - gpgsign = false |
| 136 | + gpgsign = true |
145 | 137 |
|
146 | 138 | [diff] |
147 | 139 |
|
148 | | - # Detect copies as well as renames |
| 140 | + # Detect copies as well as renames. |
149 | 141 | renames = copies |
150 | 142 |
|
151 | 143 | [diff "bin"] |
152 | 144 |
|
153 | | - # Use `hexdump` to diff binary files |
| 145 | + # Use `hexdump` to diff binary files. |
154 | 146 | textconv = hexdump -v -C |
155 | 147 |
|
156 | 148 | [help] |
157 | 149 |
|
158 | | - # Automatically correct and execute mistyped commands |
| 150 | + # Automatically correct and execute mistyped commands. |
159 | 151 | autocorrect = 1 |
160 | 152 |
|
161 | 153 | [merge] |
|
192 | 184 |
|
193 | 185 | insteadOf = "gist:" |
194 | 186 |
|
| 187 | +[init] |
| 188 | + |
| 189 | + defaultBranch = main |
| 190 | + |
195 | 191 | [gpg] |
196 | 192 | program = /usr/local/bin/gpg |
197 | 193 |
|
|
0 commit comments