Skip to content

Instantly share code, notes, and snippets.

@spartDev
Last active September 22, 2015 07:57
Show Gist options
  • Save spartDev/98059c3ac9a607d8314d to your computer and use it in GitHub Desktop.
Save spartDev/98059c3ac9a607d8314d to your computer and use it in GitHub Desktop.
My Git config
[user]
name = You Name
email = your.nam@mail.com
[color]
ui = auto
[alias]
# View the current working tree status using the short format
st = status
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
ci = commit
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ar)%Creset'
# List contributors with number of commits
contributors = shortlog --summary --numbered
# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[core]
# If you want to use Sublime Text 2's subl wrapper:
editor = subl -w
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on OS X
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
trustctime = false
autocrlf = false
[diff]
mnemonicPrefix = true
wordRegex = .
[fetch]
recurseSubmodules = on-demand
[grep]
extendedRegexp = true
[log]
abbrevCommit = true
[merge]
conflictStyle = diff3
# Include summaries of merged commits in newly created merge commit messages
log = true
tool = p4merge
[mergetool]
keepBackup = false
keepTemporaries = false
prompt = false
[pull]
# This is GREAT… when you know what you're doing and are careful
# not to pull --no-rebase over a local line containing a true merge.
# rebase = true
# WARNING! This option, which does away with the one gotcha of
# auto-rebasing on pulls, is only available from 1.8.5 onwards.
rebase = preserve
[push]
default = upstream
[rerere]
# If, like me, you like rerere, decomment these
# autoupdate = true
# enabled = true
[status]
# submoduleSummary = true
showUntrackedFiles = all
[tag]
sort = version:refname
[color]
# Use colors in Git commands that are capable of colored output when
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold # line info
old = red # deletions
new = green # additions
[color "status"]
added = yellow
changed = green
untracked = cyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment