2019-01-31 09:41:03 +01:00
|
|
|
#+TITLE: Git Configuration
|
2020-01-11 22:04:28 +01:00
|
|
|
:DRAWER:
|
|
|
|
#+STARTUP: overview
|
|
|
|
|
|
|
|
#+LANGUAGE: en
|
|
|
|
#+EMAIL: dehaeze.thomas@gmail.com
|
|
|
|
#+AUTHOR: Dehaeze Thomas
|
|
|
|
|
|
|
|
#+HTML_LINK_HOME: ./index.html
|
|
|
|
#+HTML_LINK_UP: ./index.html
|
|
|
|
|
2020-01-11 22:24:51 +01:00
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
|
2020-01-11 22:04:28 +01:00
|
|
|
:END:
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
* Gitconfig
|
2020-11-16 13:48:54 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args:conf: :tangle ~/.gitconfig
|
|
|
|
:header-args:conf+: :comments both :mkdirp yes
|
|
|
|
:END:
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
** Aliases
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[alias]
|
|
|
|
# View abbreviated SHA, description, and history graph of the latest 20 commits
|
|
|
|
l = log --pretty=oneline -n 20 --graph --abbrev-commit
|
|
|
|
|
|
|
|
# View the current working tree status using the short format
|
|
|
|
s = status -s
|
|
|
|
|
|
|
|
# Show the diff between the latest commit and the current state
|
|
|
|
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
|
|
|
|
|
|
|
|
di = diff --cached --ignore-all-space
|
|
|
|
|
|
|
|
# Pull in remote changes for the current repository and all its submodules
|
|
|
|
p = !"git pull; git submodule foreach git pull origin master"
|
|
|
|
|
|
|
|
# Clone a repository including all submodules
|
|
|
|
c = clone --recursive
|
|
|
|
|
|
|
|
# Commit all changes
|
|
|
|
ca = !git add -A && git commit -av
|
|
|
|
|
|
|
|
# Switch to a branch, creating it if necessary
|
|
|
|
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
|
|
|
|
|
|
|
|
# Show verbose output about tags, branches or remotes
|
|
|
|
tags = tag -l
|
|
|
|
branches = branch -a
|
|
|
|
remotes = remote -v
|
|
|
|
|
|
|
|
# Amend the currently staged files to the latest commit
|
|
|
|
amend = commit --amend --reuse-message=HEAD
|
|
|
|
|
|
|
|
# Credit an author on the latest commit
|
|
|
|
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
|
|
|
|
|
|
|
|
# Interactive rebase with the given number of latest commits
|
|
|
|
reb = "!r() { git rebase -i HEAD~$1; }; r"
|
|
|
|
|
|
|
|
# Remove the old tag with this name and tag the latest commit with it.
|
|
|
|
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"
|
|
|
|
|
|
|
|
# Find branches containing commit
|
|
|
|
fb = "!f() { git branch -a --contains $1; }; f"
|
|
|
|
|
|
|
|
# Find tags containing commit
|
|
|
|
ft = "!f() { git describe --always --contains $1; }; f"
|
|
|
|
|
|
|
|
# Find commits by source code
|
|
|
|
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
|
|
|
|
|
|
|
|
# Find commits by commit message
|
|
|
|
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
|
|
|
|
|
|
|
|
# Remove branches that have already been merged with master
|
|
|
|
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
|
|
|
|
|
|
|
|
# List contributors with number of commits
|
|
|
|
contributors = shortlog --summary --numbered
|
|
|
|
|
|
|
|
ec = config --global -e
|
|
|
|
|
|
|
|
# Pretty log output
|
|
|
|
hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
|
|
|
|
|
|
|
|
pp = pull origin $(git_current_branch)
|
|
|
|
gg = push origin $(git_current_branch)
|
|
|
|
rhh = reset HEAD --hard
|
|
|
|
|
|
|
|
unstage = reset HEAD --
|
|
|
|
last = log -1 HEAD
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Apply
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[apply]
|
|
|
|
# Detect whitespace errors when applying a patch
|
|
|
|
whitespace = fix
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Colors
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[color]
|
|
|
|
# Use colors in Git commands that are capable of colored output when outputting to the terminal
|
|
|
|
ui = true
|
|
|
|
|
|
|
|
[color "branch"]
|
|
|
|
current = yellow reverse
|
|
|
|
local = yellow
|
|
|
|
remote = green
|
|
|
|
HEAD = red bold
|
|
|
|
|
|
|
|
[color "diff"]
|
|
|
|
meta = yellow bold
|
|
|
|
frag = magenta bold # line info
|
|
|
|
old = red # deletions
|
|
|
|
new = green # additions
|
|
|
|
|
|
|
|
[color "status"]
|
|
|
|
added = green
|
|
|
|
changed = yellow
|
|
|
|
untracked = cyan
|
|
|
|
|
|
|
|
[color "decorate"]
|
|
|
|
HEAD = red bold
|
|
|
|
branch = green
|
|
|
|
remoteBranch = cyan
|
|
|
|
tag = yellow
|
|
|
|
stash = bold yellow
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Default Remote
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
# Use `origin` as the default remote on the `master` branch in all cases
|
|
|
|
[branch "master"]
|
|
|
|
remote = origin
|
|
|
|
merge = refs/heads/master
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Push Configuration
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[push]
|
|
|
|
default = matching
|
|
|
|
# Make `git push` push relevant annotated tags when pushing branches out.
|
|
|
|
followTags = true
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** User
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[user]
|
|
|
|
name = Thomas Dehaeze
|
|
|
|
email = dehaeze.thomas@gmail.com
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Core configuration
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[core]
|
|
|
|
# Use custom `.gitignore` and `.gitattributes`
|
|
|
|
excludesfile = ~/.gitignore_global
|
|
|
|
|
|
|
|
# Treat spaces before tabs and all kinds of trailing whitespace as an error
|
|
|
|
# [default] trailing-space: looks for spaces at the end of a line
|
|
|
|
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
|
|
|
|
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
|
|
|
|
|
|
|
|
# Prevent showing files whose names contain non-ASCII symbols as unversioned.
|
|
|
|
# http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html
|
|
|
|
precomposeunicode = false
|
|
|
|
|
|
|
|
pager = diff-so-fancy | less --tabs=4 -RFX
|
|
|
|
|
|
|
|
autocrlf = input
|
|
|
|
|
|
|
|
# Open vim, start Goyo and enter insert mode on the first line
|
2019-04-04 10:27:43 +02:00
|
|
|
editor = "nvim -c ':Goyo' -c 'goto 1' -c 'startinsert'"
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Credentials using pass
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[credential]
|
|
|
|
helper = !pass-git-helper $@
|
|
|
|
|
|
|
|
[credential "https://github.com"]
|
|
|
|
username = tdehaeze
|
2020-11-03 11:34:24 +01:00
|
|
|
|
|
|
|
[credential "https://git.tdehaeze.xyz"]
|
|
|
|
username = tdehaeze
|
2020-11-16 13:48:54 +01:00
|
|
|
|
|
|
|
[credential "https://gitlab.esrf.fr"]
|
|
|
|
username = dehaeze
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Diff-so-fancy
|
|
|
|
#+begin_src conf
|
|
|
|
[diff-so-fancy]
|
|
|
|
markEmptyLines = false
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Github
|
|
|
|
#+BEGIN_SRC conf
|
2019-08-23 10:01:34 +02:00
|
|
|
[github]
|
|
|
|
user = tdehaeze
|
|
|
|
oauth-token = 8cc5b41120f7e9a869c24fa3678667d3d8422e6f
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Global Git Ignore
|
2020-11-16 13:48:54 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args:conf: :tangle ~/.gitignore_global
|
|
|
|
:header-args:conf+: :comments both :mkdirp yes
|
|
|
|
:END:
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
*~
|
|
|
|
.DS_Store
|
|
|
|
Session.vim
|
|
|
|
#+END_SRC
|
2020-11-03 11:34:24 +01:00
|
|
|
|
|
|
|
* Pass Git Helper
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/pass-git-helper/git-pass-mapping.ini
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[github.com*]
|
|
|
|
target=github.com/tdehaeze
|
|
|
|
|
|
|
|
[git.tdehaeze.xyz*]
|
|
|
|
target=git.tdehaeze.xyz/tdehaeze
|
|
|
|
|
|
|
|
[gitlab.esrf.fr*]
|
|
|
|
target=gitlab.esrf.fr/dehaeze
|
|
|
|
#+END_SRC
|