|
5 | 5 | helper = osxkeychain |
6 | 6 | [alias] |
7 | 7 |
|
8 | | - # View abbreviated SHA, description, and history graph of the latest 20 commits |
| 8 | + # View abbreviated SHA, description, and history graph of the latest 20 commits. |
9 | 9 | l = log --pretty=oneline -n 20 --graph --abbrev-commit |
10 | 10 |
|
11 | | - # View the current working tree status using the short format |
| 11 | + # View the current working tree status using the short format. |
12 | 12 | s = status -s |
13 | 13 |
|
14 | | - # Show the diff between the latest commit and the current state |
| 14 | + # Show the diff between the latest commit and the current state. |
15 | 15 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" |
16 | 16 |
|
17 | | - # `git di $number` shows the diff between the state `$number` revisions ago and the current state |
| 17 | + # `git di $number` shows the diff between the state `$number` revisions ago and the current state. |
18 | 18 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" |
19 | 19 |
|
20 | | - # Pull in remote changes for the current repository and all its submodules |
21 | | - p = git pull --recurse-submodules |
| 20 | + # Pull in remote changes for the current repository and all its submodules. |
| 21 | + p = pull --recurse-submodules |
22 | 22 |
|
23 | | - # Clone a repository including all submodules |
| 23 | + # Clone a repository including all submodules. |
24 | 24 | c = clone --recursive |
25 | 25 |
|
26 | | - # Commit all changes |
27 | | - ca = !git add -A && git commit -av |
| 26 | + # Commit all changes. |
| 27 | + ca = !git add ':(exclude,attr:builtin_objectmode=160000)' && git commit -av |
28 | 28 |
|
29 | | - # Switch to a branch, creating it if necessary |
| 29 | + # Switch to a branch, creating it if necessary. |
30 | 30 | go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" |
31 | 31 |
|
32 | 32 | # Show verbose output about tags, branches or remotes |
33 | 33 | tags = tag -l |
34 | | - branches = branch -a |
35 | | - remotes = remote -v |
| 34 | + branches = branch --all |
| 35 | + remotes = remote --verbose |
36 | 36 |
|
37 | | - # List aliases |
| 37 | + # List aliases. |
38 | 38 | aliases = config --get-regexp alias |
39 | 39 |
|
40 | | - # Amend the currently staged files to the latest commit |
| 40 | + # Amend the currently staged files to the latest commit. |
41 | 41 | amend = commit --amend --reuse-message=HEAD |
42 | 42 |
|
43 | 43 | # Checkin |
|
49 | 49 | # Credit an author on the latest commit |
50 | 50 | credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" |
51 | 51 |
|
52 | | - # Interactive rebase with the given number of latest commits |
| 52 | + # Interactive rebase with the given number of latest commits. |
53 | 53 | reb = "!r() { git rebase -i HEAD~$1; }; r" |
54 | 54 |
|
55 | 55 | # Remove the old tag with this name and tag the latest commit with it. |
|
67 | 67 | # Find commits by commit message |
68 | 68 | fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" |
69 | 69 |
|
70 | | - # Remove branches that have already been merged with master |
| 70 | + # Remove branches that have already been merged with main. |
71 | 71 | # a.k.a. ‘delete merged’ |
72 | 72 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" |
73 | 73 |
|
74 | | - # List contributors with number of commits |
| 74 | + # List contributors with number of commits. |
75 | 75 | contributors = shortlog --summary --numbered |
76 | 76 |
|
77 | | - # Merge GitHub pull request on top of the current branch or, |
78 | | - # if a branch name is specified, on top of the specified branch |
79 | | - mpr = "!f() { \ |
80 | | - declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \ |
81 | | - declare branch=\"${2:-$currentBranch}\"; \ |
82 | | - if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ |
83 | | - git fetch origin refs/pull/$1/head:pr/$1 && \ |
84 | | - git checkout -B $branch && \ |
85 | | - git rebase $branch pr/$1 && \ |
86 | | - git checkout -B $branch && \ |
87 | | - git merge pr/$1 && \ |
88 | | - git branch -D pr/$1 && \ |
89 | | - git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ |
90 | | - fi \ |
91 | | - }; f" |
| 77 | + # Show the user email for the current repository. |
| 78 | + whoami = config user.email |
92 | 79 |
|
93 | 80 | [apply] |
94 | 81 |
|
95 | | - # Detect whitespace errors when applying a patch |
| 82 | + # Detect whitespace errors when applying a patch. |
96 | 83 | whitespace = fix |
97 | 84 |
|
| 85 | +[branch] |
| 86 | + |
| 87 | + # Show most recently changed branches first. |
| 88 | + sort = -committerdate |
| 89 | + |
98 | 90 | [core] |
99 | 91 |
|
100 | | - # Use custom `.gitignore` and `.gitattributes` |
| 92 | + # Use custom `.gitignore` and `.gitattributes`. |
101 | 93 | excludesfile = ~/.gitignore |
102 | 94 | attributesfile = ~/.gitattributes |
103 | 95 |
|
104 | | - # Treat spaces before tabs and all kinds of trailing whitespace as an error |
| 96 | + # Treat spaces before tabs and all kinds of trailing whitespace as an error. |
105 | 97 | # [default] trailing-space: looks for spaces at the end of a line |
106 | 98 | # [default] space-before-tab: looks for spaces before tabs at the beginning of a line |
107 | 99 | whitespace = space-before-tab,-indent-with-non-tab,trailing-space |
108 | 100 |
|
109 | | - # Make `git rebase` safer on macOS |
| 101 | + # Make `git rebase` safer on macOS. |
110 | 102 | # More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
111 | 103 | trustctime = false |
112 | 104 |
|
|
152 | 144 |
|
153 | 145 | [diff] |
154 | 146 |
|
155 | | - # Detect copies as well as renames |
| 147 | + # Detect copies as well as renames. |
156 | 148 | renames = copies |
157 | 149 |
|
158 | 150 | [diff "bin"] |
159 | 151 |
|
160 | | - # Use `hexdump` to diff binary files |
| 152 | + # Use `hexdump` to diff binary files. |
161 | 153 | textconv = hexdump -v -C |
162 | 154 |
|
163 | 155 | [help] |
164 | 156 |
|
165 | | - # Automatically correct and execute mistyped commands |
| 157 | + # Automatically correct and execute mistyped commands. |
166 | 158 | autocorrect = 1 |
167 | 159 |
|
168 | 160 | [merge] |
|
203 | 195 | rebase = true |
204 | 196 | [gpg] |
205 | 197 | program = gpg |
| 198 | +[init] |
| 199 | + defaultBranch = main |
0 commit comments