Skip to content

Instantly share code, notes, and snippets.

@fnky
Last active November 5, 2015 02:36
Show Gist options
  • Save fnky/278288ceff7244795c9c to your computer and use it in GitHub Desktop.
Save fnky/278288ceff7244795c9c to your computer and use it in GitHub Desktop.
git config
[hub]
protocol = https
[user]
name = Christian Petersen
email = [email protected]
[credential]
helper = osxkeychain
[alias]
st = status
ci = commit
br = branch
co = checkout
# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"
# Clone a repository including all submodules
c = clone --recursive
# Commit all changes
ca = !git add -A && git commit -av
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
df = diff
dc = diff --cached
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
gr = log --graph --full-history --all --color --pretty=tformat:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# 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"
# Remove the old tag with this name and tag the latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"
# 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"
ls = ls-files
ign = ls-files -o -i --exclude-standard
# List contributors with number of commits
contributors = shortlog --summary --numbered
# Merge GitHub pull request on top of the `master` branch
mpr = "!f() { \
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
git fetch origin refs/pull/$1/head:pr/$1 && \
git rebase master pr/$1 && \
git checkout master && \
git merge pr/$1 && \
git branch -D pr/$1 && \
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
fi \
}; f"
promote = !$ZSH/bin/git-promote
wtf = !$ZSH/bin/git-wtf
rank-contributors = !$ZSH/bin/git-rank-contributors
count = !git shortlog -sn
l = "!source ~/.githelpers && pretty_git_log"
[color]
diff = auto
interactive = auto
status = auto
branch = auto
ui = auto
[color "branch"]
current = green reverse
local = green
remote = yellow
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = green
changed = yellow
untracked = cyan
[core]
quotepath = false
autocrlf = input
precomposeunicode = false
excludesfile = ~/.gitignore
editor = subl -w
trustctime = false
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
precomposeunicode = false
[apply]
whitespace = fix
[mergetool]
keepBackup = false
prompt = false
[difftool]
prompt = false
[help]
autocorrect = 1
[push]
# See `git help config` (search for push.default)
# for more information on different options of the below setting.
#
# Setting to git 2.0 default to surpress warning message
default = simple
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustexitcode = true
[merge]
log = true
tool = Kaleidoscope
[push]
default = matching
followTags = true
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[diff]
renames = copies
tool = Kaleidoscope
[diff "bin"]
textconv = hexdump -v -C
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
# URL Shorthands
[url "[email protected]:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "[email protected]:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment