|
10 | 10 | # View abbreviated SHA, description, and history graph of the latest 20 commits |
11 | 11 | l = log --pretty=oneline -n 20 --graph --abbrev-commit |
12 | 12 |
|
13 | | - # View the current working tree status using the short format |
| 13 | + # View the current working tree status using the short format. |
14 | 14 | s = status -s |
15 | 15 |
|
16 | | - # Show the diff between the latest commit and the current state |
| 16 | + # Show the diff between the latest commit and the current state. |
17 | 17 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" |
18 | 18 |
|
19 | | - # `git di $number` shows the diff between the state `$number` revisions ago and the current state |
| 19 | + # `git di $number` shows the diff between the state `$number` revisions ago and the current state. |
20 | 20 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" |
21 | 21 |
|
22 | | - # Pull in remote changes for the current repository and all its submodules |
23 | | - p = git pull --recurse-submodules |
| 22 | + # Pull in remote changes for the current repository and all its submodules. |
| 23 | + p = pull --recurse-submodules |
24 | 24 |
|
25 | | - # Clone a repository including all submodules |
| 25 | + # Clone a repository including all submodules. |
26 | 26 | c = clone --recursive |
27 | 27 |
|
28 | | - # Commit all changes |
| 28 | + # Commit all changes. |
29 | 29 | ca = !git add -A && git commit -av |
30 | 30 |
|
31 | | - # Switch to a branch, creating it if necessary |
| 31 | + # Switch to a branch, creating it if necessary. |
32 | 32 | go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" |
33 | 33 |
|
34 | 34 | # Show verbose output about tags, branches or remotes |
35 | 35 | tags = tag -l |
36 | | - branches = branch -a |
37 | | - remotes = remote -v |
| 36 | + branches = branch --all |
| 37 | + remotes = remote --verbose |
38 | 38 |
|
39 | | - # List aliases |
| 39 | + # List aliases. |
40 | 40 | aliases = config --get-regexp alias |
41 | 41 |
|
42 | | - # Amend the currently staged files to the latest commit |
| 42 | + # Amend the currently staged files to the latest commit. |
43 | 43 | amend = commit --amend --reuse-message=HEAD |
44 | 44 |
|
45 | | - # Credit an author on the latest commit |
| 45 | + # Credit an author on the latest commit. |
46 | 46 | credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" |
47 | 47 |
|
48 | | - # Interactive rebase with the given number of latest commits |
| 48 | + # Interactive rebase with the given number of latest commits. |
49 | 49 | reb = "!r() { git rebase -i HEAD~$1; }; r" |
50 | 50 |
|
51 | 51 | # Remove the old tag with this name and tag the latest commit with it. |
|
63 | 63 | # Find commits by commit message |
64 | 64 | fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" |
65 | 65 |
|
66 | | - # Remove branches that have already been merged with master |
| 66 | + # Remove branches that have already been merged with main. |
67 | 67 | # a.k.a. ‘delete merged’ |
68 | 68 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" |
69 | 69 |
|
70 | | - # List contributors with number of commits |
| 70 | + # List contributors with number of commits. |
71 | 71 | contributors = shortlog --summary --numbered |
72 | 72 |
|
73 | | - # Merge GitHub pull request on top of the current branch or, |
74 | | - # if a branch name is specified, on top of the specified branch |
75 | | - mpr = "!f() { \ |
76 | | - declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \ |
77 | | - declare branch=\"${2:-$currentBranch}\"; \ |
78 | | - if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ |
79 | | - git fetch origin refs/pull/$1/head:pr/$1 && \ |
80 | | - git checkout -B $branch && \ |
81 | | - git rebase $branch pr/$1 && \ |
82 | | - git checkout -B $branch && \ |
83 | | - git merge pr/$1 && \ |
84 | | - git branch -D pr/$1 && \ |
85 | | - git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ |
86 | | - fi \ |
87 | | - }; f" |
88 | | -
|
89 | 73 | # Show the user email for the current repository. |
90 | 74 | whoami = config user.email |
91 | 75 |
|
92 | 76 | [apply] |
93 | 77 | # Detect whitespace errors when applying a patch |
94 | 78 | whitespace = fix |
95 | 79 |
|
| 80 | +[branch] |
| 81 | + |
| 82 | + # Show most recently changed branches first. |
| 83 | + sort = -committerdate |
| 84 | + |
96 | 85 | [core] |
| 86 | + # Use Sublime Text as my preferred editor |
97 | 87 | editor = subl -w |
| 88 | + |
98 | 89 | # Use custom `.gitignore` and `.gitattributes` |
99 | 90 | excludesfile = ~/.gitignore |
100 | 91 | attributesfile = ~/.gitattributes |
101 | 92 |
|
102 | | - # Treat spaces before tabs and all kinds of trailing whitespace as an error |
| 93 | + # Treat spaces before tabs and all kinds of trailing whitespace as an error. |
103 | 94 | # [default] trailing-space: looks for spaces at the end of a line |
104 | 95 | # [default] space-before-tab: looks for spaces before tabs at the beginning of a line |
105 | 96 | whitespace = space-before-tab,-indent-with-non-tab,trailing-space |
106 | 97 |
|
107 | | - # Make `git rebase` safer on macOS |
| 98 | + # Make `git rebase` safer on macOS. |
108 | 99 | # More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
109 | 100 | trustctime = false |
110 | 101 |
|
|
195 | 186 |
|
196 | 187 | [url "git://gist.github.com/"] |
197 | 188 | insteadOf = "gist:" |
| 189 | + |
| 190 | +[init] |
| 191 | + |
| 192 | + defaultBranch = main |
0 commit comments