Skip to content

Instantly share code, notes, and snippets.

@kmorcinek

kmorcinek/gitconfig

Last active Mar 31, 2020
Embed
What would you like to do?
Add it to ".gitconfig" file in your user directory. Configuration & aliases for git.
[core]
# autocrlf = true/input # it should be done explicit using .gitattributes https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings
[pull]
rebase = true
[push]
default = current
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate
lst = log --pretty=format:%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an] --decorate -10
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate --date=short
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate --numstat
lol = log --graph --decorate --pretty=oneline --abbrev-commit --all
cp = cherry-pick
st = status -s
ci = commit
co = checkout
br = branch
diff = diff --word-diff
wdiff = diff --word-diff=plain
dc = diff --cached
r = reset
r1 = reset HEAD^
rh = reset --hard
rh1 = reset --hard HEAD^
rh2 = reset --hard HEAD^^
ready = rebase -i @{u}
amend = commit --amend -aC HEAD
undo = reset --soft HEAD^
#clean = add . && git rh
# standup = log --since '1 day ago' --oneline --author <YOUREMAIL> # hack it with your email and uncomment
# jira = log --since '6am' --oneline --author <YOUREMAIL> # hack it with your email and uncomment
# git-svn
spull = svn rebase
spush = svn dcommit
# even faster aliases
aa = add --all
com = checkout master
cam = commit -am
ac = !git add -A && git commit
acam = !git add -A && git commit -am
ri2 = rebase -i HEAD~2
ri3 = rebase -i HEAD~3
ri5 = rebase -i HEAD~5
ri9 = rebase -i HEAD~9
ri22 = rebase -i HEAD~22
ri = rebase -i
rc = rebase --continue
ra = rebase --abort
rs = rebase --skip
mt = mergetool
ref1 = reset --hard HEAD@{1}
ref2 = reset --hard HEAD@{2}
cv = checkout - # checkout on previous branch, faster to type than 'cb'
cod = checkout develop
red = rebase develop
rem = rebase master
syncd = !git checkout develop && git pull --rebase && git checkout - && git rebase develop
syncm = !git checkout master && git pull --rebase && git checkout - && git rebase master
riod = rebase -i origin/develop # rebase origin/develop
cppb = cherry-pick HEAD@{1} # Cherry-pick previous branch
pushf = push --force-with-lease
revh = revert HEAD
fp = fetch --prune
# Some common commit messages
dead = commit -am 'Remove dead code'
readme = commit *.md -m'Just update readme'
# Add files based on extension
cs = add *.cs
js = add *.js
ts = add *.ts
sql = add *.sql
json = add *.json
java = add *.java
yml = add *.yml
[merge]
tool = kdiff3
[mergetool "kdiff3"]
path = c:/Program Files/KDiff3/kdiff3.exe
[diff]
tool = kdiff3
guitool = kdiff3
[difftool "kdiff3"]
path = c:/Program Files/KDiff3/kdiff3.exe
[mergetool]
keepBackup = false
[color]
ui = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment