Last active
May 15, 2017 15:42
-
-
Save sunny/11223609 to your computer and use it in GitHub Desktop.
Sunny's Gitconfig
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
# See https://www.kernel.org/pub/software/scm/git/docs/git-config.html | |
[user] | |
email = sunny@sunfox.org | |
name = Sunny Ripert | |
[github] | |
user = sunny | |
[core] | |
# Default editor. Use `subl -w` for Sublime Text. | |
editor = vim | |
# Autoconvert line endings from CRLF (Windows) to LF (everybody else) | |
autocrlf = input | |
# Global gitignore file | |
excludesfile = ~/.gitignore_global | |
# Helps using commands with unicode characters on OSX | |
quotepath = false | |
# Helps using unicode characters in filenames on file systems like HFS+ on OSX | |
precomposeunicode = true | |
[credential] | |
# Use OSX's keychain to remember your passwords | |
helper = osxkeychain | |
[help] | |
# Activate Git's autocorrect after a number of seconds ("Did you mean") | |
autocorrect = 20 | |
[apply] | |
# Fix whitespace | |
whitespace = strip | |
[push] | |
default = current | |
[branch "master"] | |
remote = origin | |
merge = refs/heads/master | |
[alias] | |
## Infos | |
ls = ls-files | |
praise = blame | |
st = status -sb | |
# Local and remote branches | |
b = branch -av | |
# Ordered local branches with remote name | |
br = !git-br | |
# Log | |
l = log --pretty=format:'%C(yellow)%h%Creset %Cgreen%an %Cblue%cr%Creset: %s%C(yellow)%d%Creset' --abbrev-commit --date=relative | |
lg = log --graph --pretty=format:'%C(yellow)%h%Creset %Cgreen%an %Cblue%cr%Creset: %s%C(yellow)%d%Creset' --abbrev-commit --date=relative | |
## Commit | |
cam = commit -am | |
wtc = "!git commit -m \"$(curl -s http://whatthecommit.com/index.txt)\"" | |
wip = "!git commit -m \"$(git branch-name) WIP\"" | |
credit = !git commit --amend --author "$1 <$2>" | |
fixup = !sh -c 'git commit --fixup=$1' - | |
squash = !sh -c 'git commit --squash=$1' - | |
ri = rebase --interactive --autosquash | |
## Managing branches | |
# New branch | |
nb = checkout -b | |
# Via https://gist.github.com/robmiller/6018582 | |
# Get the current branch name (not so useful in itself, but used in | |
# other aliases) | |
branch-name = "!git rev-parse --abbrev-ref HEAD" | |
# Push the current branch to the remote "origin", and set it to track | |
# the upstream branch | |
publish = "!git push -u origin $(git branch-name)" | |
# Delete the remote version of the current branch | |
unpublish = "!git push origin :$(git branch-name)" | |
# Delete a named branch locally and on origin | |
delete-branch = !git branch -d $@ && git push origin :$@ | |
# Interactively rebase all the commits on the current branch | |
rebase-branch = "!git rebase -i `git merge-base master HEAD`" | |
## Pull/Push | |
# Pull rebase | |
pr = !git pull --rebase && git fetch --tags | |
# http://github.com/sunny/git-deploy | |
deploy = !git-deploy | |
## Staging | |
# Unstage any files that have been added to the staging area | |
unstage = reset HEAD | |
# Checkout our version of a file and add it | |
ours = "!f() { git checkout --ours $@ && git add $@; }; f" | |
# Checkout their version of a file and add it | |
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f" | |
## Cleaning | |
# Delete any branches that have been merged into master | |
cleanup-repo = !git-cleanup-repo | |
# Fetch all remotes, with tags and remove dead branches | |
f = fetch --all --tags --prune | |
## Legit extension | |
# http://www.git-legit.org/ | |
switch = !legit switch \"$@\" | |
branches = !legit branches | |
sprout = !legit sprout \"$@\" | |
harvest = !legit harvest \"$@\" | |
sync = !legit sync \"$@\" | |
graft = !legit graft \"$@\" | |
# Commented to use simpler publish/unpublish (see below) | |
# publish = !legit publish \"$@\" | |
# unpublish = !legit unpublish \"$@\" | |
# delete-branch = !git branch -d $@ && git push origin :$@ | |
# Color all the things | |
[color] | |
ui = auto | |
diff = auto | |
interactive = auto | |
status = auto | |
branch = auto | |
pager = true | |
[color "branch"] | |
current = cyan reverse | |
local = cyan | |
remote = magenta | |
[color "diff"] | |
meta = yellow | |
[color "status"] | |
header = cyan | |
added = yellow | |
changed = green | |
untracked = cyan | |
nobranch = red bold | |
# Git media extension configuration | |
# https://github.com/schacon/git-media | |
[filter "media"] | |
clean = git-media-clean %f | |
smudge = git-media-smudge %f |
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
# Via https://gist.github.com/octocat/9257657 | |
# Packages # | |
############ | |
# it's better to unpack these files and commit the raw source | |
# git has its own built in compression methods | |
*.7z | |
*.dmg | |
*.gz | |
*.iso | |
*.jar | |
*.rar | |
*.tar | |
*.zip | |
# OS generated files # | |
###################### | |
.DS_Store | |
.DS_Store? | |
._* | |
.Spotlight-V100 | |
.Trashes | |
ehthumbs.db | |
Thumbs.db |
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
#!/bin/sh | |
# Via http://stackoverflow.com/a/18213567/311657 | |
current_branch="$(git symbolic-ref --short -q HEAD)" | |
git for-each-ref --sort=committerdate refs/heads \ | |
--format='%(refname:short)|%(objectname:short)|%(committerdate:relative)|%(authorname)|%(subject)|%(upstream:short)' \ | |
| while IFS='|' read refname objectname date authorname subject upstream | |
do | |
reverse='\x1b[7m' | |
reset='\e[0m' | |
green='\e[32m' | |
red='\e[31m' | |
yellow='\e[33m' | |
blue='\e[34m' | |
cyan='\e[36m' | |
start=' ' | |
if [[ $refname = $current_branch ]]; then | |
start='\x1b[7m* ' | |
fi | |
printf "$cyan$start%-55s$reset $yellow%s $green%s $blue%s: $reset%s $cyan%s\\n" "$refname" "$objectname" "$authorname" "$date" "$subject" "$upstream" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment