config/.gitconfig

182 lines
5.5 KiB
INI
Raw Normal View History

# some tricks come from https://blog.gitbutler.com/git-tips-and-tricks/
2009-11-20 11:57:39 +01:00
[user]
name = Mathieu Maret
2011-04-18 16:36:24 +02:00
email = mathieu.maret@gmail.com
2009-11-20 11:57:39 +01:00
[color]
ui = auto
diff = auto
status = auto
2009-11-20 11:57:39 +01:00
branch = auto
2010-09-15 18:09:24 +02:00
[pack]
threads = 0
2009-11-20 11:57:39 +01:00
[alias]
st = status
ci = commit
cm = commit -m
2017-11-24 10:41:07 +01:00
cia = commit --amend
cias = commit --amend --no-edit
co = checkout
2023-01-05 17:32:59 +01:00
sw = switch
2012-05-30 14:26:03 +02:00
br = branch
df = diff
dc = diff --cached
2020-11-10 21:45:44 +01:00
# lg = log -p
2012-05-30 14:26:03 +02:00
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
2015-02-26 15:21:14 +01:00
lolp = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
2020-11-10 21:45:44 +01:00
lg = log -p --pretty=fuller --abbrev-commit
lgg = log --pretty=fuller --abbrev-commit --stat
2012-05-30 14:26:03 +02:00
ls = ls-files
2016-10-18 11:06:09 +02:00
dt = difftool # to have diff with meld
2014-07-30 14:08:20 +02:00
mylog = log --committer=\"$(git config user.name)\"
2016-10-18 11:06:09 +02:00
please = push --force-with-lease
2014-09-17 11:53:44 +02:00
# Remove last commit but keep changes
2016-10-18 11:06:09 +02:00
undo = reset --soft HEAD^
2014-09-17 11:53:44 +02:00
revertpart = reset -p HEAD^
diffword = diff --color-words=.
2016-10-18 11:06:09 +02:00
save = stash save -u
#rebase last N commits
rb = "!f() { git rebase -i HEAD~$1; }; f"
#rebase since branching on branch N
rbi = !sh -c \"git rebase -i `git merge-base $1 HEAD`\" -
cleanbr = remote prune origin
cleanbrshow = remote prune origin --dry-run
cleanupbr = "!git branch --merged | grep -v '\\*\\|master\\|develop\\|dev' | xargs -n 1 git branch -d"
2023-01-24 16:16:09 +01:00
# Remove local branch that have been removed on the server
cleanupbrprune = "!git fetch --prune"
contains = !sh -c 'git branch -a --contains $1' -
2017-11-24 10:41:07 +01:00
wdiff = diff --word-diff=color --unified=1
2018-01-22 11:30:59 +01:00
first = rev-list --max-parents=0 HEAD # or use log --reverse
2019-06-20 14:20:27 +02:00
rebasestash = rebase --autostash # stash before rebase if needed
#Gitlab checkout merge request. e.g. get MR 5 on remote upstream git mr upstream 5
mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
#Git reset upstream
ru = "!f() { \
REMOTES=$(git remote); \
REMOTE=\"origin\"; \
case \"$REMOTES\" in \
*upstream*) \
REMOTE=\"upstream\"; \
;; \
esac; \
git fetch $REMOTE; \
git update-ref refs/heads/master refs/remotes/$REMOTE/master; \
git checkout master >/dev/null 2>&1; \
git reset --hard $REMOTE/master >/dev/null 2>&1; \
git checkout - >/dev/null 2>&1; \
}; f"
code-changes = "!git log --format=format: --name-only | egrep -v '^$' | sort | uniq -c | sort -rg | head -10"
cc = "!git code-changes"
fixup = "commit --fixup"
2022-07-12 14:22:52 +02:00
ri = "rebase -i --autostash --autosquash"
up = pull --rebase --autostash
2022-07-12 14:22:52 +02:00
rebaseour = "rebase -Xours"
2023-01-24 16:16:09 +01:00
rank = "shortlog -s -n --no-merges"
root = rev-parse --show-toplevel
staash = stash --all
# -w ignore whitespace. -C 3 time, detect lines moved or copied in any commit
blamef = blame -w -C -C -C
# Show the log having the modificatoin for $1
search =!sh -c "git log -S $1 -p"
# remove a folder from history
rmdirfromhistory=!sh -c "git-filter-repo --path $1 --invert-paths"
2023-01-17 17:53:54 +01:00
[rebase]
# when rebasing, update the other common branch too.
# See https://andrewlock.net/working-with-stacked-branches-in-git-is-easier-with-update-refs/
# Need git 2.38
updateRefs = true
autoStash = true
2016-10-18 11:06:09 +02:00
[branch]
sort = -committerdate
2016-10-18 11:06:09 +02:00
#New branch track remote
2019-06-20 14:20:27 +02:00
#autosetupmerge = always
# Rebase on git pull
#autosetuprebase = always
# in .gitattributes
# *.doc diff=word
# *.xsl diff=excel
# *.xlsx diff=zip
# *.docx diff=wordx
# *.png diff=exif
2016-10-18 11:06:09 +02:00
[diff "odf"]
textconv=odt2txt
[diff "odt"]
textconv=odt2txt
2019-06-20 14:20:27 +02:00
[diff "pandoc"]
textconv=pandoc --to=markdown
prompt = false
[diff "wordx"]
textconv = docx2txt_wrap
[diff "word"]
textconv = catdoc
[diff "excel"]
textconv = strings
[diff "zip"]
textconv = unzip -c -a
[diff "exif"]
textconv = exiftool
2015-06-30 15:48:10 +02:00
[difftool "meld"]
path = /usr/bin/meld
trustExitCode = false
[difftool]
prompt = false
[diff]
tool = meld
compactionHeuristic = true
2015-06-30 15:48:10 +02:00
[mergetool "meld"]
path = /usr/bin/meld
trustExitCode = false
[mergetool]
2016-10-18 11:06:09 +02:00
# do not keep .ori file after a merge
2015-06-30 15:48:10 +02:00
keepBackup = false
[merge]
tool = meld
2016-10-18 11:06:09 +02:00
# tool = vimdiff
# conflictstyle = diff3
2013-02-25 17:16:30 +01:00
[push]
default = current #push to upstream assuming same name for the upstream and current branch
#default = upstream # pushed to the configuer upstream branch
2013-12-13 11:37:40 +01:00
[credential]
helper = cache --timeout=3600
2014-03-07 11:22:09 +01:00
[sendemail]
from = Mathieu Maret <mathieu.maret@gmail.com>
smtpserver = smtp.gmail.com
smtpuser = mathieu.maret
smtpencryption = tls
smtpserverport = 587
# smtppass = PASS
2014-09-03 11:33:11 +02:00
[web]
browser = firefox
2015-02-26 15:21:14 +01:00
[rerere]
enabled = true
[pager]
log = /usr/share/git/diff-highlight/diff-highlight | less
show = /usr/share/git/diff-highlight/diff-highlight | less
diff = /usr/share/git/diff-highlight/diff-highlight | less
[interactive]
diffFilter = /usr/share/git/diff-highlight/diff-highlight
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[pull]
2020-07-28 12:54:56 +02:00
#rebase = true
ff = only
[commit]
verbose = true
[column]
ui = auto
[gpg]
#Sign with ssh key (check signingkey)
format = ssh
[maintenance]
# start maintenance on a repo with git maintenance start
#repo = /home/mmaret/Sources/matos
[fetch]
#For large repo. Update the commit graph at each commit to have git log --graph super fast
#writeCommitGraph = true