Skip to content

Instantly share code, notes, and snippets.

@jcarsique
Last active February 24, 2022 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcarsique/24f8dd46d176bb67253e to your computer and use it in GitHub Desktop.
Save jcarsique/24f8dd46d176bb67253e to your computer and use it in GitHub Desktop.
.gitconfig .gitaliases
# Standalone aliases install:
# wget https://gist.githubusercontent.com/jcarsique/24f8dd46d176bb67253e/raw/.gitaliases -O ~/.gitaliases
# git config --global include.path ~/.gitaliases
[alias]
ls = "ls-tree --name-only"
ll = "ls-tree -l"
st = status -sb
ci = commit
co = checkout
br = branch
branches = branch -a
glog = log --graph --abbrev-commit --date=relative
mergenff = merge --no-ff
in = "!git remote update -p; git log ..@{u}"
out = log @{u}..
outall = log --branches --not --remotes=origin
lg = log --graph --pretty=format:'%C(auto)%h -%d %s %C(bold blue)<%an>' --abbrev-commit --color
lgshort = log --graph --pretty=format:'%C(auto)%d %s' --abbrev-commit --color
lgfull = log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an> %C(green bold)%G?' --abbrev-commit --color
logd = log --left-right --graph --cherry-pick --oneline ...@{u}
logone = log --pretty=format:'%C(auto)%m %h %Cgreen%ad %C(blue)%<(20)%aN %Creset%s %N %C(auto)%d %C(green bold)%G?' --left-right --cherry-pick --date=short
logjira = "!_() { : git log ; git log $@ |grep -E -ohw '[A-Z]+-[[:digit:]]+'|sort -u; }; _"
di = diff
dic = diff --staged
id = show -s --pretty=format:'%C(auto)%h%d'
pullr = "!git fetch \"$@\" && git rebase --autostash @{push}"
pullnor = pull --no-rebase
who = "shortlog -ne --format='%h %s'"
rollback = reset --soft HEAD^
lc = log --pretty=oneline --abbrev-commit --graph --decorate ORIG_HEAD.. --stat --no-merges
latest = for-each-ref --count=10 --sort=-committerdate --format='%(committerdate:short) %(refname:short)'
latestl = for-each-ref --count=10 --sort=-committerdate refs/heads --format='%(committerdate:short) %(refname:short)'
#authorship = "!git ls-files -z|xargs -0 -n1 -E'\n' | git blame --date short -wCMcp -- | perl -pe 's/^.*?\\((.*?) +\\d{4}-\\d{2}-\\d{2} +\\d+\\).*/\\1/'| sort | uniq -c | sort -rn"
authorship = "!git ls-files -z|xargs -0 -n1 git blame --line-porcelain HEAD|grep \"^author \"|sort|uniq -c|sort -nr"
fix = "!_() { : git rev-parse ; c=$(git rev-parse $1) && git commit --fixup $c && git -c core.editor=cat rebase -i --autosquash --keep-empty --autostash $c~; }; _"
rebasei = "!_() { : git rebase -i ; git diff-index --quiet HEAD; s=$?; [ $s != 0 ] && git stash; git rebase -i $1 && [ $s != 0 ] && git stash pop; }; _"
## git clone https://github.com/git-cola/git-cola ~/workspace/git-cola
xbase = "!GIT_SEQUENCE_EDITOR=$HOME/workspace/git-cola/share/git-cola/bin/git-xbase git rebase"
stash-rename = "!_() { : git stash drop ; rev=$(git rev-parse $1) && git stash drop $1 || exit 1 ; git stash store -m \"$2\" $rev;}; _"
rbranch-rename = "!_() { : git branch ; [ \"$#\" -lt 2 ] && echo 'Usage: rbranch-rename [remote] old_branch_name new_branch_name' && exit 1; \
if [ \"$#\" -gt 2 ]; then REMOTE=$1; shift; else REMOTE=origin; fi; git push $REMOTE $REMOTE/$1:refs/heads/$2 :$1; }; _"
oldest-ancestor = "!bash -c ': git branch ; diff -u1 <(git rev-list --first-parent \"${1:-master}\") <(git rev-list --first-parent \"${2:-HEAD}\") | sed -ne \"s/^ //p\"' -"
pr-hash = "!sh -c ': git checkout ; git ls-remote origin| grep \"refs/pull/$1/head\"| cut -f1' -"
resign = "!_() { : git checkout ; [ \"$#\" -eq 0 ] && echo 'Usage: resign <rev-list>' && exit 2; \
git filter-branch --commit-filter ' \
if [ \"$GIT_COMMITTER_EMAIL\" = \"jcarsique@nuxeo.com\" ]; then git commit-tree -S \"$@\"; else git commit-tree \"$@\"; fi' $1; }; _"
pr-list = "!hub pr list -f \"%pC%>(4)%i%Creset %<(20)%B %<(30)%H %t %>|(180)%au %l%n\""
contains = "!_() { p=$1; shift; for ref in $(git log --all --grep=$p --pretty='%h'); do git branch $* --contains $ref; git tag --contains $ref; done; }; _"
#pomversion = "!_() { git show $1:pom.xml|grep 'version>'|uniq -u; }; _"
pomversion = "!_() { : git show ; shas="${*:-'HEAD'}"; for sha in $shas; do (git show $sha:pom.xml|grep 'version>'|uniq -u); done; }; _"
[user]
name = Julien Carsique
email = ...
signingKey = ...
[include]
# Standalone aliases install:
# wget https://gist.githubusercontent.com/jcarsique/24f8dd46d176bb67253e/raw/.gitaliases -O .git/gitaliases
# git config --global include.path ~/.gitaliases
path = .gitaliases
[color]
diff = auto
interactive = auto
showbranch = true
sh = auto
branch = auto
grep = auto
ui = auto
status = auto
[core]
autocrlf = input
safecrlf = warn
# git clone https://github.com/github/gitignore ~/workspace/gitignore
excludesfile = $HOME/workspace/gitignore/Global/Eclipse.gitignore
ignorecase = false
whitespace = trailing-space,space-before-tab
pager = less -FXRS
attributesFile = ~/.gitattributes
[pager]
diff = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight | less -FRXsu --tabs=4
[init]
# mkdir -p ~/.git_template/hooks/
# wget https://gist.githubusercontent.com/jcarsique/7643059/raw/adc53560307a898c9327e4521c659072f90c7243/pre-commit -O ~/.git_template/hooks/pre-commit
templatedir = ~/.git_template
[apply]
whitespace = fix
[push]
default = upstream
[branch]
autosetupmerge = true
autosetuprebase = always
[diff]
renames = true
copies = true
mnemonicprefix = true
tool = diffmerge
[merge]
conflictstyle = diff3
tool = diffmerge
renormalize=true
[mergetool]
keepBackup = false
[mergetool "diffmerge"]
cmd = diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE
trustExitCode = true
[difftool "diffmerge"]
cmd = diffmerge $LOCAL $REMOTE
[difftool "kdiff3"]
trustExitCode = false
[mergetool "kdiff3"]
trustExitCode = false
[difftool "meld"]
trustExitCode = false
[mergetool "meld"]
trustExitCode = false
[difftool "atom"]
[mergetool "atom"]
cmd = atom -w $MERGED
trustExitCode = false
[difftool "intellij"]
cmd = /snap/bin/intellij-idea-community diff $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE")
[mergetool "intellij"]
cmd = /snap/bin/intellij-idea-community merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[difftool "idea"]
cmd = idea diff $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE")
[mergetool "idea"]
cmd = idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[guitool "Rebase onto..."]
cmd = git rebase
revprompt = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip"]
cmd = git rebase --skip
[guitool "Rebase/Abort"]
cmd = git rebase --abort
[guitool "Pull with Rebase"]
cmd = git pull --rebase
[gui]
spellingdictionary = none
encoding = utf-8
[github]
# sudo gem install hub
# hub hub standalone > ~/bin/hub && chmod +x ~/bin/hub
user = jcarsique
token = ****
# for Git beginners: useful to learn the commands
#[achievement]
# upload = true
# git clone https://github.com/jcarsique/git-achievements ~/workspace/git-achievements
# dir = $HOME/workspace/git-achievements
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
smtpuser = ***
smtpserverport = 587
confirm=always
[git-up "bundler"]
# sudo gem install git-up
check = true
[rerere]
enabled = true
[pull]
rebase = preserve
[remote "origin"]
fetch = +refs/pull/*/head:refs/remotes/origin/pull/*
[gpg]
program = gpg2
[commit]
gpgSign = true
[tag]
forceSignAnnotated = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = yellow
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[diff "word"]
# Requires ~/bin/docx2txt executable containing: "docx2txt.pl $1 -"
# Used in Git attributes file with: "*.docx diff=word"
textconv = docx2txt
[diff "exif"]
# Used in Git attributes file with: "*.jpg diff=exif"
textconv = exiftool
[diff "zip"]
textconv = unzip -c -a
[diff "sopsdiffer"]
textconv = sops -d
[diff "tgz"]
binary = true
textconv = tar -xvzO -f
[filter "lfs"]
smudge = git-lfs smudge -- %f
required = true
clean = git-lfs clean -- %f
[remote "origin"]
fetch = +refs/pull/*/head:refs/remotes/origin/pull/*
#[includeIf "gitdir:~/work/code/"]
# path = .gitconfig-nuxeo
[credential]
helper = cache --timeout=3600
[rebase]
autoStash = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment