Skip to content

Instantly share code, notes, and snippets.

@spetroll
Last active April 14, 2016 13:08
Show Gist options
  • Save spetroll/97fde8c7f852195b8b807bc3731ef4af to your computer and use it in GitHub Desktop.
Save spetroll/97fde8c7f852195b8b807bc3731ef4af to your computer and use it in GitHub Desktop.
Gitconfig
[user]
name = Sven Petroll
email = sven.petroll@gmail.com
[alias]
s = status -s
a = !git add . && git status
au = !git add -u . && git status
aa = !git add . && git add -u . && git status
ai = add -i
p = add --patch
c = commit
cm = commit -m
ca = commit --amend
co = checkout
cob = checkout -b
ac = !git add . && git commit
acm = !git add . && git commit -m
spull = svn rebase
spush = svn dcommit
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -10
ll = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lll = log --stat --abbrev-commit
d = diff --color-words
dh = diff --color-words head
master = checkout master
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
code-review = difftool origin/master...
# list aliases
alias = "!git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort"
clean-merged = "!git branch --merged | grep -v \"\\*\" | xargs -n 1 git branch -d"
# 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)"
# Given a merge commit, find the span of commits that exist(ed) on that
# branch. Again, not so useful in itself, but used by other aliases.
merge-span = "!f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f"
# Find the commits that were introduced by a merge
merge-log = "!git log `git merge-span .. $1`"
# Show the changes that were introduced by a merge
merge-diff = "!git diff `git merge-span ... $1`"
# As above, but in your difftool
merge-difftool = "!git difftool `git merge-span ... $1`"
unstage = reset HEAD
# Show changes that have been staged
diffc = diff --cached
zip = "!zipArchive() { git archive --format zip --output $1 $(git branch-name); }; zipArchive"
[core]
pager = less -r
autocrlf = true
preloadindex = true
fscache = true
[color]
ui = auto # covers diff = true, status = auto, branch = auto
interactive = auto
[merge]
ff = only
tool = p4merge
[merge]
tool = p4merge
[mergetool "p4merge"]
path = C:\\Program Files\\Perforce\\p4merge.exe
[diff]
tool = p4merge
[difftool "p4merge"]
path = C:\\Program Files\\Perforce\\p4merge.exe
[url "https://"]
insteadOf = git://
[gui]
recentrepo = D:/st-development/Project/EnevSketchup
[difftool "sourcetree"]
cmd = 'C:/Program Files/Perforce/p4merge.exe' \"$LOCAL\" \"$REMOTE\"
[gc]
auto = 256
[pull]
rebase = preserve
[rerere]
enabled = true
autoupdate = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment