|
9 | 9 | [apply] |
10 | 10 | # Detect whitespace errors when applying a patch |
11 | 11 | whitespace = fix |
| 12 | +[alias] |
| 13 | + |
| 14 | + # View abbreviated SHA, description, and history graph of the latest 20 commits. |
| 15 | + l = log --pretty=oneline -n 20 --graph --abbrev-commit |
| 16 | + |
| 17 | + # View the current working tree status using the short format. |
| 18 | + s = status -s |
| 19 | + |
| 20 | + # Show the diff between the latest commit and the current state. |
| 21 | + d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" |
| 22 | + |
| 23 | + # `git di $number` shows the diff between the state `$number` revisions ago and the current state. |
| 24 | + di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" |
| 25 | + |
| 26 | + # Pull in remote changes for the current repository and all its submodules. |
| 27 | + p = pull --recurse-submodules |
| 28 | + |
| 29 | + # Clone a repository including all submodules. |
| 30 | + c = clone --recursive |
| 31 | + |
| 32 | + # Commit all changes. |
| 33 | + ca = !git add -A && git commit -av |
| 34 | + |
| 35 | + # Switch to a branch, creating it if necessary. |
| 36 | + go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" |
| 37 | + |
| 38 | + # Show verbose output about tags, branches or remotes |
| 39 | + tags = tag -l |
| 40 | + branches = branch --all |
| 41 | + remotes = remote --verbose |
| 42 | + |
| 43 | + # List aliases. |
| 44 | + aliases = config --get-regexp alias |
| 45 | + |
| 46 | + # Amend the currently staged files to the latest commit. |
| 47 | + amend = commit --amend --reuse-message=HEAD |
| 48 | + |
| 49 | + # Credit an author on the latest commit. |
| 50 | + credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" |
| 51 | + |
| 52 | + # Interactive rebase with the given number of latest commits. |
| 53 | + reb = "!r() { git rebase -i HEAD~$1; }; r" |
| 54 | + |
| 55 | + # Remove the old tag with this name and tag the latest commit with it. |
| 56 | + retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r" |
| 57 | + |
| 58 | + # Find branches containing commit |
| 59 | + fb = "!f() { git branch -a --contains $1; }; f" |
| 60 | + |
| 61 | + # Find tags containing commit |
| 62 | + ft = "!f() { git describe --always --contains $1; }; f" |
| 63 | + |
| 64 | + # Find commits by source code |
| 65 | + fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" |
| 66 | + |
| 67 | + # Find commits by commit message |
| 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 | + |
| 70 | + # Remove branches that have already been merged with main. |
| 71 | + # a.k.a. ‘delete merged’ |
| 72 | + dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" |
| 73 | + |
| 74 | + # List contributors with number of commits. |
| 75 | + contributors = shortlog --summary --numbered |
| 76 | + |
| 77 | + # Show the user email for the current repository. |
| 78 | + whoami = config user.email |
| 79 | + |
| 80 | +[apply] |
| 81 | + |
| 82 | + # Detect whitespace errors when applying a patch. |
| 83 | + whitespace = fix |
| 84 | + |
| 85 | +[branch] |
| 86 | + |
| 87 | + # Show most recently changed branches first. |
| 88 | + sort = -committerdate |
| 89 | + |
| 90 | +[core] |
| 91 | + |
| 92 | + # Use custom `.gitignore` and `.gitattributes`. |
| 93 | + excludesfile = ~/.gitignore |
| 94 | + attributesfile = ~/.gitattributes |
| 95 | + |
| 96 | + # Treat spaces before tabs and all kinds of trailing whitespace as an error. |
| 97 | + # [default] trailing-space: looks for spaces at the end of a line |
| 98 | + # [default] space-before-tab: looks for spaces before tabs at the beginning of a line |
| 99 | + whitespace = space-before-tab,-indent-with-non-tab,trailing-space |
| 100 | + |
| 101 | + # Make `git rebase` safer on macOS. |
| 102 | + # More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
| 103 | + trustctime = false |
| 104 | + |
| 105 | + # Prevent showing files whose names contain non-ASCII symbols as unversioned. |
| 106 | + # http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html |
| 107 | + precomposeunicode = false |
| 108 | + |
| 109 | + # Speed up commands involving untracked files such as `git status`. |
| 110 | + # https://git-scm.com/docs/git-update-index#_untracked_cache |
| 111 | + untrackedCache = true |
| 112 | + |
12 | 113 | [color] |
13 | 114 | branch = auto |
14 | 115 | diff = auto |
|
32 | 133 | gpgsign = true |
33 | 134 | template = /Users/thomas.deutsch/.stCommitMsg |
34 | 135 | [diff] |
35 | | - # Detect copies as well as renames |
36 | | - renames = copies |
| 136 | + |
| 137 | + # Detect copies as well as renames. |
| 138 | + renames = copies |
| 139 | + |
37 | 140 | [diff "bin"] |
38 | | - # Use `hexdump` to diff binary files |
39 | | - textconv = hexdump -v -C |
| 141 | + |
| 142 | + # Use `hexdump` to diff binary files. |
| 143 | + textconv = hexdump -v -C |
| 144 | + |
40 | 145 | [help] |
41 | | - # Automatically correct and execute mistyped commands |
42 | | - autocorrect = 1 |
| 146 | + |
| 147 | + # Automatically correct and execute mistyped commands. |
| 148 | + autocorrect = 1 |
| 149 | + |
43 | 150 | [merge] |
44 | 151 | # Include summaries of merged commits in newly created merge commit messages |
45 | 152 | log = true |
|
74 | 181 | [mergetool "sourcetree"] |
75 | 182 | cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" |
76 | 183 | trustExitCode = true |
| 184 | + |
| 185 | +# URL shorthands |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + insteadOf = "gh:" |
| 190 | + pushInsteadOf = "github:" |
| 191 | + pushInsteadOf = "git://github.com/" |
| 192 | + |
| 193 | +[url "git://github.com/"] |
| 194 | + |
| 195 | + insteadOf = "github:" |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + insteadOf = "gst:" |
| 200 | + pushInsteadOf = "gist:" |
| 201 | + pushInsteadOf = "git://gist.github.com/" |
| 202 | + |
| 203 | +[url "git://gist.github.com/"] |
| 204 | + |
| 205 | + insteadOf = "gist:" |
| 206 | + |
77 | 207 | [init] |
| 208 | + |
| 209 | + defaultBranch = main |
| 210 | + |
78 | 211 | templateDir = ~/.git_config/template/ |
| 212 | + |
| 213 | + # https://git-scm.com/docs/git-config#git-config-pushdefault |
| 214 | + default = simple |
| 215 | + # Make `git push` push relevant annotated tags when pushing branches out. |
| 216 | + followTags = true |
0 commit comments