Last active
August 7, 2017 22:04
-
-
Save op-ct/b0ef2adb116f99612f2f to your computer and use it in GitHub Desktop.
.gitconfiggery
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
[alias] | |
# colorful log with one-line entries | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
# colorful log with a summary of updated files | |
lgf = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --name-only | |
# colorful log with a summary of updated files & the commit message | |
lgff = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\n\n%b' --abbrev-commit --name-only | |
# commit history fun (source: przemoc/dotfiles) | |
cad = !"f() { ADATE=\"$(git log -1 --pretty=format:'%ai')\"; GIT_COMMITTER_DATE=\"$ADATE\" git commit --amend \"$@\"; }; f" | |
cadc = !"f() { CDATE=\"$(git log -1 --pretty=format:'%ci')\"; GIT_COMMITTER_DATE=\"$CDATE\" git commit --amend --date=\"$CDATE\" \"$@\"; }; f" | |
cadn = !"f() { NDATE=\"$(date -R -d \"$*\")\"; GIT_COMMITTER_DATE=\"$NDATE\" git commit --amend --date=\"$NDATE\"; }; f" | |
cadna = !"f() { NDATE=\"$(date -R -d \"$*\")\"; CDATE=\"$(git log -1 --pretty=format:'%ci')\"; GIT_COMMITTER_DATE=\"$CDATE\" git commit --amend --date=\"$NDATE\"; }; f" | |
cadnc = !"f() { NDATE=\"$(date -R -d \"$*\")\"; GIT_COMMITTER_DATE=\"$NDATE\" git commit --amend; }; f" | |
# add remotes for SIMP development (mutated from Trevor's "raa" aliases) | |
ra-gerrit = "!f() { url=`git config --get remote.origin.url`; reponame=`basename $url`; git remote add gerrit \"ssh://[email protected]:29418/simp/${reponame}\" 2>/dev/null; }; f" | |
ra-origin = "!f() { origin_url=`git config --get remote.origin.url`; if [ -z \"${origin_url}\" ]; then url=`git config --get remote.upstream.url`; else url=$origin_url; fi; reponame=`basename $url`; git remote rm origin 2>/dev/null || true; git remote add origin \"[email protected]:op-ct/${reponame}\" ;}; f" | |
ra-upstream = "!f() { origin_url=`git config --get remote.origin.url`; if [ -z \"${origin_url}\" ]; then url=`git config --get remote.upstream.url`; else url=$origin_url; fi; reponame=`basename $url`; git remote rm upstream 2>/dev/null || true; git remote add upstream \"https://github.com/simp/${reponame}.git\"; }; f" | |
ra-upstream-danger = "!f() { origin_url=`git config --get remote.origin.url`; if [ -z \"${origin_url}\" ]; then url=`git config --get remote.upstream.url`; else url=$origin_url; fi; reponame=`basename $url`; git remote rm upstream 2>/dev/null || true; git remote add upstreamDANGER \"git://github.com/simp/${reponame}\"; }; f" | |
ra-all = "!f() { git ra-gerrit; git ra-origin; git ra-upstream; ra-upstream-danger }; f" | |
ra-pr = "!f() { if [ ! -n \"$1\" ]; then echo Usage:; echo \" git ra-pr GITHUB_USERNAME\" ; exit 1; fi; url=`git config --get remote.origin.url`; if [ -z \"${url}\" ]; then url=`git config --get remote.$1.url`; else url=$url; fi; reponame=`basename $url`; git remote rm upstream 2>/dev/null || true; git remote add $1 \"[email protected]:${1}/${reponame}\"; }; f" | |
# refresh from upstream/$1 and update origin/$ | |
# refresh = "!f() { git checkout $1 && git pull upstream \"$1\" && git push origin \"$1\"; }; f" | |
refresh = "!f() { if [ ! -n \"$1\" ]; then echo Usage:; echo \" git refresh BRANCH\" ; exit 1; fi; git checkout $1 && git pull upstream \"$1\" && git push origin \"$1\"; }; f" | |
ss = "status -s" | |
# xxx | |
cg = "!f() { curbr=`git rev-parse --abbrev-ref HEAD`; git diff --shortstat gerrit/$curbr upstream/$curbr; }; f" | |
grog = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\" | |
[push] | |
default = simple | |
[core] | |
editor = vim | |
[merge] | |
tool = vimdiff | |
conflictstyle = diff3 | |
[mergetool] | |
prompt = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment