|
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=format:'%C(magenta)%G? %C(auto)%h %d %s' -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 | | - # Full status |
| 9 | + # Full status. |
10 | 10 | st = status |
11 | 11 |
|
12 | | - # Show the diff between the latest commit and the current state |
| 12 | + # Show the diff between the latest commit and the current state. |
13 | 13 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" |
14 | 14 |
|
15 | | - # Pull in remote changes for the current repository and all its submodules |
16 | | - p = git pull --recurse-submodules |
17 | | - |
18 | | - # `git di $number` shows the diff between the state `$number` revisions ago and the current state |
| 15 | + # `git di $number` shows the diff between the state `$number` revisions ago and the current state. |
19 | 16 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" |
20 | 17 |
|
21 | | - # Pull in remote changes for the current repository and all its submodules |
22 | | - p = git pull --recurse-submodules |
| 18 | + # Pull in remote changes for the current repository and all its submodules. |
| 19 | + p = pull --recurse-submodules |
23 | 20 |
|
24 | | - # Clone a repository including all submodules |
| 21 | + # Clone a repository including all submodules. |
25 | 22 | c = clone --recursive |
26 | 23 |
|
27 | | - # Commit all changes |
| 24 | + # Commit all changes. |
28 | 25 | ca = !git add -A && git commit -av |
29 | 26 |
|
30 | | - # Switch to a branch, creating it if necessary |
| 27 | + # Switch to a branch, creating it if necessary. |
31 | 28 | go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" |
32 | 29 |
|
33 | | - # Checkout |
| 30 | + # Checkout. |
34 | 31 | co = checkout |
35 | 32 |
|
36 | | - # Show verbose output about tags, branches or remotes |
| 33 | + # Show verbose output about tags, branches or remotes. |
37 | 34 | tags = tag -l |
38 | 35 | branches = branch -a |
39 | 36 | remotes = remote -v |
40 | 37 |
|
41 | | - # List aliases |
| 38 | + # List aliases. |
42 | 39 | aliases = config --get-regexp alias |
43 | 40 |
|
44 | | - # Amend the currently staged files to the latest commit |
| 41 | + # Amend the currently staged files to the latest commit. |
45 | 42 | amend = commit --amend --reuse-message=HEAD |
46 | 43 |
|
47 | | - # Credit an author on the latest commit |
| 44 | + # Credit an author on the latest commit. |
48 | 45 | credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" |
49 | 46 |
|
50 | | - # Interactive rebase with the given number of latest commits |
| 47 | + # Interactive rebase with the given number of latest commits. |
51 | 48 | reb = "!r() { git rebase -i HEAD~$1; }; r" |
52 | 49 |
|
53 | 50 | # Remove the old tag with this name and tag the latest commit with it. |
54 | 51 | retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r" |
55 | 52 |
|
56 | | - # Find branches containing commit |
| 53 | + # Find branches containing commit. |
57 | 54 | fb = "!f() { git branch -a --contains $1; }; f" |
58 | 55 |
|
59 | | - # Find tags containing commit |
| 56 | + # Find tags containing commit. |
60 | 57 | ft = "!f() { git describe --always --contains $1; }; f" |
61 | 58 |
|
62 | | - # Find commits by source code |
| 59 | + # Find commits by source code. |
63 | 60 | fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" |
64 | 61 |
|
65 | | - # Find commits by commit message |
| 62 | + # Find commits by commit message. |
66 | 63 | fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" |
67 | 64 |
|
68 | | - # Remove branches that have already been merged with master |
| 65 | + # Remove branches that have already been merged with main. |
69 | 66 | # a.k.a. ‘delete merged’ |
70 | 67 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" |
71 | 68 |
|
72 | 69 | # List contributors with number of commits |
73 | 70 | contributors = shortlog --summary --numbered |
74 | 71 |
|
75 | | - # Merge GitHub pull request on top of the current branch or, |
76 | | - # if a branch name is specified, on top of the specified branch |
77 | | - mpr = "!f() { \ |
78 | | - declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \ |
79 | | - declare branch=\"${2:-$currentBranch}\"; \ |
80 | | - if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ |
81 | | - git fetch origin refs/pull/$1/head:pr/$1 && \ |
82 | | - git checkout -B $branch && \ |
83 | | - git rebase $branch pr/$1 && \ |
84 | | - git checkout -B $branch && \ |
85 | | - git merge pr/$1 && \ |
86 | | - git branch -D pr/$1 && \ |
87 | | - git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ |
88 | | - fi \ |
89 | | - }; f" |
90 | | -
|
91 | 72 | # Show the user email for the current repository. |
92 | 73 | whoami = config user.email |
93 | 74 |
|
94 | | - # Amazon recommended alias setup |
95 | | - dag = log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)%an <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order |
96 | | -
|
97 | | - # Show the user email for the current repository. |
98 | | - whoami = config user.email |
99 | | -
|
100 | 75 | [apply] |
101 | 76 |
|
102 | | - # Detect whitespace errors when applying a patch |
| 77 | + # Detect whitespace errors when applying a patch. |
103 | 78 | whitespace = fix |
104 | 79 |
|
| 80 | +[branch] |
| 81 | + |
| 82 | + # Show most recently changed branches first. |
| 83 | + sort = -committerdate |
| 84 | + |
105 | 85 | [core] |
106 | 86 |
|
107 | | - # Use custom `.gitignore` and `.gitattributes` |
| 87 | + # Use custom `.gitignore` and `.gitattributes`. |
108 | 88 | excludesfile = ~/.gitignore |
109 | 89 | attributesfile = ~/.gitattributes |
110 | 90 |
|
111 | | - # 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. |
112 | 92 | # [default] trailing-space: looks for spaces at the end of a line |
113 | 93 | # [default] space-before-tab: looks for spaces before tabs at the beginning of a line |
114 | 94 | whitespace = space-before-tab,-indent-with-non-tab,trailing-space |
115 | 95 |
|
116 | | - # Make `git rebase` safer on macOS |
| 96 | + # Make `git rebase` safer on macOS. |
117 | 97 | # More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
118 | 98 | trustctime = false |
119 | 99 |
|
|
125 | 105 | # https://git-scm.com/docs/git-update-index#_untracked_cache |
126 | 106 | untrackedCache = true |
127 | 107 |
|
128 | | - # Amazon recommended pager config |
| 108 | + # Recommended pager config |
129 | 109 | pager = less -FMRiX |
130 | 110 |
|
131 | 111 | [color] |
|
160 | 140 |
|
161 | 141 | [diff] |
162 | 142 |
|
163 | | - # Detect copies as well as renames |
| 143 | + # Detect copies as well as renames. |
164 | 144 | renames = copies |
165 | 145 |
|
166 | 146 | [diff "bin"] |
167 | 147 |
|
168 | | - # Use `hexdump` to diff binary files |
| 148 | + # Use `hexdump` to diff binary files. |
169 | 149 | textconv = hexdump -v -C |
170 | 150 |
|
171 | 151 | [help] |
172 | 152 |
|
173 | | - # Automatically correct and execute mistyped commands |
| 153 | + # Automatically correct and execute mistyped commands. |
174 | 154 | autocorrect = 1 |
175 | 155 |
|
176 | 156 | [merge] |
177 | 157 |
|
178 | | - # Include summaries of merged commits in newly created merge commit messages |
| 158 | + # Include summaries of merged commits in newly created merge commit messages. |
179 | 159 | log = true |
180 | 160 |
|
181 | 161 | [push] |
|
206 | 186 | [url "git://gist.github.com/"] |
207 | 187 |
|
208 | 188 | insteadOf = "gist:" |
| 189 | + |
| 190 | +[init] |
| 191 | + |
| 192 | + defaultBranch = main |
0 commit comments