Skip to content

Instantly share code, notes, and snippets.

@greenbicycle
Last active July 11, 2021 04:22
Show Gist options
  • Save greenbicycle/0ce204435027ad396d6b070e3153b5cc to your computer and use it in GitHub Desktop.
Save greenbicycle/0ce204435027ad396d6b070e3153b5cc to your computer and use it in GitHub Desktop.
.gitconfig file for a Mac
# Change the stuff in angle brackets <>
[user]
name = <Your name>
email = <[email protected]>
[core]
autocrlf = input
safecrlf = true
pager =
excludesfile = /Users/<username>/.gitignore_global
editor = nano
[alias]
co = checkout
ci = commit
st = status
br = branch
bc = branch --contains
oneline = log -n 20 --oneline --format=format:'%C(bold cyan)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
type = cat-file -t
dump = cat-file -p
staged = diff --staged
unmerged = diff --name-only --diff-filter=U
untracked = ls-files --others --exclude-standard
merge = merge -Xignore-all-space
changed = diff --name-only HEAD^
contains = branch --contains
graph = log --graph --abbrev-commit --date=iso
hash = log -n 1 --format=format:'%h'
[push]
default = current
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[color]
ui = true
[color "branch"]
current = blue
local = cyan bold
remote = green bold
[color "diff"]
meta = white
frag = red bold
old = yellow dim
new = green bold
whitespace = white reverse
[color "status"]
added = green
changed = yellow
untracked = red
branch = magenta
[commit]
template = ~/.git
[format]
pretty = format:%C(bold cyan)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)
[merge]
tool = opendiff
[diff]
tool = opendiff
[mergetool]
keepBackup = false
[format]
pretty = format:%C(bold cyan)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%$
[merge]
tool = opendiff
[diff]
tool = opendiff
[mergetool]
keepBackup = false
@greenbicycle
Copy link
Author

I added git bc for git branch --contains since I have been using that a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment