Created
July 18, 2013 16:17
-
-
Save awayken/6030692 to your computer and use it in GitHub Desktop.
My incredible, tricked-out, super helpful, awesome git config.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
## Compound command alias | |
# View all alias | |
alias = !"git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\t=> \\2/' | sort" | |
# Pull in remote changes for the current repository and all its submodules | |
p = !"git pull; git submodule foreach git pull origin master" | |
# Stage all missing files for delete | |
r = !"git ls-files -z --deleted | xargs -0 git rm" | |
# Show all files modified using `git assume` alias | |
assumed = !"git ls-files -v | grep ^h | cut -c 3-" | |
# Snapshot our progress without committing anything | |
snapshot = !git stash save "Snapshot on $(date)" && git stash apply "stash@{0}" | |
# Pull or push our common branches to their remote origins | |
pullall = !"git checkout dev && git pull && git checkout test_dev && git pull && git checkout master && git pull" | |
pushall = !"git checkout dev && git push origin dev && git checkout test_dev && git push origin test_dev && git checkout master && git push origin master" | |
## Parametric command alias | |
# `git di $number` Show the diff between now and the `$number`th previous commit | |
di = !"a1() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; a1" | |
# `git credit $name $email` Credit an author on the latest commit | |
credit = !"a2() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; a2" | |
# `git reb $number` Interactive rebase with the `$number` of previous commits | |
reb = !"a3() { git rebase -i HEAD~$1; }; a3" | |
# `git check $branch` Check commits on `$branch` against the remote origin/`$branch` | |
check = !"a4() { git fetch origin; git diff --patch origin/$1 $1; }; a4" | |
# `git checkgone $branch` Check commits on `$branch` against the remote origin/`$branch` looking for deleted files | |
checkgone = !"a5() { git diff origin/$1 $1 | grep -B 1 'deleted'; }; a5" | |
# `git ohfuck $branch` Reset `$branch` to origin/`$branch` | |
ohfuck = !"a6() { git fetch origin; git reset --hard origin/$1; }; a6" | |
## Single command alias | |
# Make a new branch | |
make = checkout -b | |
# Save your commit | |
save = commit --message | |
# View a more decorative log | |
history = log --oneline --decorate --graph | |
# Undo a `git push` | |
undopush = push --force origin HEAD^:master | |
# Throw away the last commit | |
ohshit = reset --hard HEAD^ | |
# Assume a file is unchanged so it doesn't show in our index | |
assume = update-index --assume-unchanged | |
# Unassume a file modified using `git assume` alias | |
unassume = update-index --no-assume-unchanged | |
# Show verbose output about tags, branches or remotes | |
tags = tag --list | |
branches = branch --all --verbose | |
remotes = remote --verbose | |
# Common branches | |
live = checkout master | |
dev = checkout dev | |
test = checkout test_dev | |
[apply] | |
# Detect whitespace errors when applying a patch | |
whitespace = fix | |
[core] | |
# Use custom `.gitignore` and `.gitattributes` | |
excludesfile = ~/.gitignore | |
attributesfile = ~/.gitattributes | |
# Set Sublime Text 2 as GIT_EDITOR in Windows | |
editor = 'C:\\Program Files\\Sublime Text 2\\sublime_text.exe' -w | |
# Enforces some of my whitespace preferences | |
whitespace = space-before-tab,tab-in-indent,blank-at-eol | |
[color] | |
# Use colors in Git commands that are capable of colored output when outputting to the terminal | |
ui = auto | |
[color "branch"] | |
current = yellow bold | |
local = green bold | |
remote = magenta bold | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
[color "status"] | |
added = cyan bold | |
updated = green bold | |
changed = red bold | |
untracked = magenta bold | |
branch = yellow bold | |
[merge] | |
# Include summaries of merged commits in newly created merge commit messages | |
log = true | |
[push] | |
default = simple | |
# 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:" | |
[user] | |
name = Miles Rausch | |
# email = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment