Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 88 lines (74 sloc) 3.88 KB
[user]
email = piotr@wittchen.io
name = Piotr Wittchen
[core]
autocrlf = input
editor = vim
excludesfile = ~/.gitignore_global
[alias]
; showing metadata
list-aliases = !git config -l | grep alias | cut -c 7- | sort
; showing urls
show-remote-url = config --get remote.origin.url
; showing status
status-detailed = status -sb
is-dirty = status --porcelain
; showing commits, logs & branches
my-commits = "!git log --author=\"`git config user.name`\" --pretty=format:\"%cd %h %s\" --date=short"
my-commits-today = "!git log --author=\"`git config user.name`\" --pretty=format:\"%cd %h %s\" --date=short --since=00:00:00 --all --no-merges"
my-commits-last-month = "!git log --author=\"`git config user.name`\" --pretty=format:\"%cd %h %s\" --date=short --since=\"30 days ago\" --all --no-merges"
last-commit-msg = log -1 --pretty=%B
last-commit-hash = log -1 --pretty=%h
top-commiters = shortlog -sn
log-hist = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
log-oneline = log --pretty=format:'%C(yellow)%h %ad%Cred%d %Creset %s %C(bold blue)[%cn]%Creset' --decorate --date=short
branches-by-last-modified = !git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'
list-new-unstaged-files = ls-files --others --exclude-standard
list-contributors = shortlog -sn
; ignoring files
ignore-local = update-index --assume-unchanged
unignore-local = update-index --no-assume-unchanged
ignored-local = !git ls-files -v | grep "^[[:lower:]]"
; adding & reviewing changes
review-changes = add -p
add-all = add -A
; resetting and reverting changes
reset-file = checkout HEAD --
discard-uncommited-changes = reset --hard
discard-unstaged-changes = checkout -- .
remove-from-stage = reset HEAD --
undo-last-commit = reset --hard HEAD^
; side note: git reset <filename> makes undo after git add command
revert-merge-commit=git revert -m 1
; commit hash should be provided for the command above and it should be confirmed with commit
; removing untracked files
show-untracked-files-to-remove=clean -n
remove-untracked-files=clean -f
; merging changes
merge-local-commits = !sh -c 'git reset --soft HEAD~$1' - ; merges n (arg) commits into one
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
; branching
new-branch = checkout -b
delete-local-branch = branch -d
force-delete-local-branch = branch -D
delete-remote-branch = push origin --delete
; deletes any branches that have been merged into master, see also: https://gist.github.com/robmiller/5133264
delete-branches-merged-to-master = "!git checkout master && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
delete-branches-merged-to-develop = "!git checkout develop && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
; pushing changes
fire=!git-fire ; should be called in the case of fire
; to make it work, script from https://github.com/qw3rtman/git-fire needs to be placed in /usr/local/bin/ dir
; showing diffs
diff-commit = diff --cached HEAD^ ; shows diff from last commit
diff-staged = diff --staged ; shows diff after git add command
; searching files
find-file= !git ls-files | grep -i
[push]
default = simple
[diff]
tool = vimdiff
; interesting references for git aliases and configuration:
; - https://gist.github.com/mwhite/6887990
; - http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
; - https://gist.github.com/robmiller/6018582
; - https://github.com/git-tips/tips