Skip to content

Instantly share code, notes, and snippets.

@jesperronn
Last active November 28, 2020 05:04
Show Gist options
  • Save jesperronn/3047625 to your computer and use it in GitHub Desktop.
Save jesperronn/3047625 to your computer and use it in GitHub Desktop.
Standard Git Config global options
#!/bin/bash
# Standard shortcuts for my usual git configuration
#
# http://www.arthurkoziel.com/2008/05/02/git-configuration/
#
#
# SVN-like shortcuts for often used commands:
git config --global alias.st status -bs
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.cp cherry-pick
# Make sure to remove directories from the svn tree if there are no files left in it
# from https://git.wiki.kernel.org/index.php/Git-svn
git config --global svn.rmdir true
#from http://travisjeffery.com/b/2012/02/search-a-git-repo-like-a-ninja/
#NOTE: (--break, --heading) does not work with git 1.7.4.4, but works with 1.7.10.2
git config --global alias.g "grep --break --heading --line-number"
# one from our corp. repos:
git config --global alias.lol "log --oneline --graph --decorate"
git config --global --add alias.loa 'log --pretty=format:"%C(red)%cr%C(blue) %h %C(reset)%an %Cgreen%d%x09%Cblue%s %C(yellow)(%ad)" --abbrev-commit --decorate=short --date=local'
git config --global --add alias.ls 'log --pretty=format:"%C(red)%cr%C(blue) %h %C(reset)%an %Cgreen%d%x09%Cblue%s %C(yellow)(%ad)" --abbrev-commit --decorate=short --date=local'
# Colorized output:
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto
# pro tip from https://training.github.com/kit/advanced/#mastering-shortcuts-efficiencies
# Avoid repetitive conflicts, Reuse recorded resolution
git config --global rerere.enable true
#prune automatically http://stackoverflow.com/questions/18308535/automatic-prune-with-git-fetch-or-pull
git config --global remote.origin.prune true
#abbreviate commit hashes by default
git config --global log.abbrevCommit true
# git push local will create remote branch http://stackoverflow.com/questions/11872984
git config --global push.default current
@jesperronn
Copy link
Author

Just pimped my git oneliner-log.
loa = log --pretty=format:"%C(reset)%C(dim)%h%C(reset)%C(auto)%d %C(yellow)%s%C(reset)%C(blue) (%C(magenta)%an%C(blue))%C(white)%C(dim)@%ad, %cr%C(reset)%C(dim)" --abbrev-commit --date=short

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment