Last active
November 28, 2020 05:04
-
-
Save jesperronn/3047625 to your computer and use it in GitHub Desktop.
Standard Git Config global options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
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
Example for retrieving a new branch not present when you inited from SVN:
http://stackoverflow.com/questions/296975/how-do-i-tell-git-svn-about-a-remote-branch-created-after-i-fetched-the-repo
BASE=svn://forge.xleap.apmoller.net/data/svnrepos/forge/core
BRANCH=orion
git config --add svn-remote.$BRANCH.url $BASE/branches/$BRANCH
git config --add svn-remote.$BRANCH.fetch :refs/remotes/$BRANCH
git svn fetch $BRANCH
git checkout -b local-$BRANCH -t $BRANCH