Skip to content

Instantly share code, notes, and snippets.

@johnpena
Created October 24, 2016 18:28
Show Gist options
  • Save johnpena/a3bd9e4389595a78e42201e2328d634d to your computer and use it in GitHub Desktop.
Save johnpena/a3bd9e4389595a78e42201e2328d634d to your computer and use it in GitHub Desktop.
.gitconfig stuff
# Stick this in ~/.gitconfig
[alias]
# Shortcuts:
st = status -sb
br = branch
co = checkout
sha = rev-parse HEAD
# List all tracked files:
ls = ls-files
# Which files are getting changed the most?
churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}'
# Show all offending files when you get a merge conflict:
conflicts = diff --name-only --diff-filter=U
# What's changed recently?
changes = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
changes-by-date = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
changes-by-hour = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
# What have I worked on recently?
standup = !"git log --reverse --branches --since='$(if [[ "Mon" == "$(date +%a)" ]]; then echo "last friday"; else echo "yesterday"; fi)' --author=$(git config --get user.email) --format=format:'%C(cyan) %ad %C(yellow)%h %Creset %s %Cgreen%d' --date=local"
# Save a repo as a tarball
export = archive -o latest.tar.gz -9 --prefix=latest/
[push]
# Stop bothering me about where I want to push:
default=upstream
[core]
editor = vim
excludesfile = /path/to/global/gitignore
[web]
browser = google-chrome
# These url aliases enable the following:
# $ git clone gh:johnpena/johnpena.github.io
# $ git clone gist:johnpena/1234234
# $ git clone bb:johnpena/my-bb-repo
[url "https://github.com/"]
insteadOf = gh:
[url "https://gist.github.com/"]
insteadOf = gist:
[url "https://bitbucket.org/"]
insteadOf = bb:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment