Skip to content

Instantly share code, notes, and snippets.

@davidmpaz
Last active September 27, 2015 22:58
Show Gist options
  • Save davidmpaz/1345062 to your computer and use it in GitHub Desktop.
Save davidmpaz/1345062 to your computer and use it in GitHub Desktop.
git config for future references. Avoiding losts ( after a profile lost :P ) at all cost.
[user]
name = David Moises Paz Reyes
email = [email protected]
[core]
editor = vim
autocrlf = input
[log]
date = relative
[alias]
co = checkout
cm = commit
df = diff
st = status
flog = log --pretty=format:\"%h - %an, %ar : %s\" --stat
glog = log --pretty=format:\"%h - %ar : %s\" --stat --graph
olog = log --oneline
# only pack files changed betwen commits passed
packupdates = "!f() { git archive -o pack-$1-$2.zip HEAD $(git diff --name-only $1...$2); }; f"
# pack everything from a branch
packrelease = "!f() { git archive -o pack-$1.zip --format zip $1; }; f"
# gives files changed from master to te branch name passed
listchanged = "!f() { git diff --name-only master...$1; }; f"
# remove on git deleted files by hand
rm-rm = "!f() { git rm $(git ls-files --deleted); }; f"
# ever added files in a commit that shouldn't be there? this remove them all
rm-fcm = "!f() { git rm $(git diff-tree --no-commit-id --name-only -r $1); }; f"
# find commits made that edit certain lines of file
# $1 : file to look at
# $2 : start line to look at
# $3 : number of lines to look at after provided start line
find-edit-cm = "! f() { git rev-list HEAD -- $1 | ( while read rev; do git blame -l -L $2,+$3 $rev -- 1 | cut -d ' ' -f 1; done; ) | awk '{ if (!h[$0]) { print $0; h[$0]=1 } }' | xargs -L 1 git log --oneline -1; }; f"
# gitignore.io
gi = "!f() { curl http://www.gitignore.io/api/$@ ; }; f"
[color]
branch = auto
diff = auto
grep = auto
interactive = auto
pager = true
showbranch = auto
status = auto
ui = true
[color "diff"]
meta = cyan normal bold
old = red normal bold
new = green normal bold
[color "branch"]
remote = cyan normal bold
local = normal normal ul
current = green normal bold
[color "status"]
header = cyan normal bold
added = green normal bold
changed = magenta normal bold
untracked = red normal bold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment