Skip to content

Instantly share code, notes, and snippets.

@akofod
Created November 19, 2015 16:06
Show Gist options
  • Save akofod/3ad9ad576a319d42f5bb to your computer and use it in GitHub Desktop.
Save akofod/3ad9ad576a319d42f5bb to your computer and use it in GitHub Desktop.
Personalized .gitconfig
[user]
name = Zackary Lowery
email = [email protected]
[push]
default = simple
[http]
# Expanded for large initial pushes to a remote
postBuffer = 524288000
[alias]
# Git Immersion ############################################################
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
# durdn.com Pretty Logs ####################################################
# List commits in short form, with colors and branch/tag annotations
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
# List commits showing changed files
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# List with no colors if you need to chain the output with Unix pipes
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
# List oneline commits showing dates
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# List oneline commits showing relative dates
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
# Default look for short git log
le = log --oneline --decorate
# durdn.com File Diffs #####################################################
# See all the commits related to a file, with the diff of the changes
filelog = log -u
fl = log -u
# Show modified files in last commit
dl = "!git ll -1"
# Show diff last commit
dlc = diff --cached HEAD^
# Show content (full diff) of a commit given a revision
dr = "!f() { git diff "$1"^.."$1"; }; f"
lc = "!f() { git ll "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
# durdn.com Finding Files and File Contents
# Find a file path in codebase
f = "!git ls-files | grep -i"
# Search/grep your entire codebase for a string
grep = grep -Ii
gr = grep -Ii
# Grep from repository root
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
# Aliases ##################################################################
# durdn.com Output all aliases
la = "!git config -l | grep alias | cut -c 7-"
# durdn.com Basic Shortcuts ################################################
cp = cherry-pick
sts = status -s
cl = clone
wdiff = diff --word-diff
dc = diff --cached
# durdn.com Git Reset Shortcuts ############################################
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# durdn.com Git Stash Shortcuts #############################################
sl = stash list
sa = stash apply
ss = stash save
[merge]
tool = meld
[mergetool "meld"]
keeptemporaries = false
trustExitCode = false
keepbackup = false
cmd = meld $LOCAL $BASE $REMOTE -o $MERGED --diff $BASE $LOCAL --diff $BASE $REMOTE
[diff]
guitool = meld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment