Skip to content

Instantly share code, notes, and snippets.

@dbazuin
Forked from fubhy/.gitconfig
Created August 5, 2013 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbazuin/6156835 to your computer and use it in GitHub Desktop.
Save dbazuin/6156835 to your computer and use it in GitHub Desktop.
[user]
# Credentials.
name = Foo Bar
email = foo@bar.com
drupal = $(whoami)
[credential]
# Save passwords in ~/.git-credentials.
helper = store
[core]
bare = false
filemode = true
ignorecase = true
logallrefupdates = true
quotepath = false
# Fix whitespace errors.
whitespace = fix,-indent-with-non-tab,-indent-with-tab,trailing-space,cr-at-eol
# Global .gitignore file.
excludesfile = ~/.gitignore
# Use "less" as the pager. This will provide nice colors.
pager = less -R
[apply]
whitespace = fix
[branch]
# automatically link new branch to start-point branch (upstream)
autosetupmerge = true
autosetuprebase = always
[help]
# wait .5 seconds before autocorrecting
autocorrect = 5
[push]
# Ensure that when you `git push` only the current branch is pushed rather than all branches (why is this not the de$
default = current
[rerere]
# Reuse recorded resolution of conflicted merges:
# - http://shop.oreilly.com/product/0636920024774.do
# - http://git-scm.com/2010/03/08/rerere.html
enabled = true
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = blue bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
# list aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
# shortcut for 'git status'
st = status
# shortcut for 'git commit'
ci = commit
# shortcut for 'git branch'
br = branch
# shortcut for 'git checkout'
co = checkout
# shortcut for 'git diff'
df = diff
# shows an abbreviated git log with nice formatting
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date$
# performs 'git stash', 'git pull' and 'git stash pop' in a sequence
pu = !git stash && git pull && git stash pop
# removes all unstaged files except for .patch files.
cn = clean -df --exclude=*.patch
# locate commit where a particular file was introduced
added-file = log --diff-filter=A --
# list contributor stats for this repo
contributors = !git shortlog -n -s --no-merges $@ | cat - && echo && echo total $(git rev-list --count HEAD)
# list commits not yet pushed to remote
local = log --branches --not --remotes
# show branches that have been merged into current (HEAD) branch
merged = !git fetch --all && git branch --all --merged HEAD
# show branches that have not been merged into current (HEAD) branch
not-merged = !git fetch --all && git branch --all --no-merged HEAD
# decorated graph view of one liner summarized commits from all branches. (inspired by git-extras)
tree = log --all --graph --decorate --oneline --simplify-by-decoration
# stage and commit given file
checkin = !git stage "$*" && git commit $!
# undo local changes
undo = checkout --
# remove staged changes from the index: (1) provide file name/pattern (2) otherwise, removes all
unstage = reset HEAD --
# list contributor stats for this repo
contributors = !git shortlog -n -s --no-merges $@ | cat - && echo && echo total $(git rev-list --count HEAD)
# count modified files
count-modified = !echo $(git status --porcelain | grep -E '[^MARC]' | wc -l | awk '{ print $1 }') files modified
# clone a d.o project.
dc = !sh -c 'git clone $(git config --global user.drupal)@git.drupal.org:project/$1.git $@' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment