From 49fc201f65a2c285ea8d7de6cb687e53c6656b6f Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Tue, 13 Sep 2022 16:24:12 -0500 Subject: feat(git): move .gitconfig to conform to XDG_BASE_DIR --- git/.config/git/config | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 git/.config/git/config (limited to 'git/.config') diff --git a/git/.config/git/config b/git/.config/git/config new file mode 100644 index 0000000..97f8622 --- /dev/null +++ b/git/.config/git/config @@ -0,0 +1,101 @@ +[include] +path = ~/.config/git/config.d/local.inc + +[user] +email = tobyv13@gmail.com +name = Toby Vincent +username = tobyvin +signingkey = 0xA0876F29023F43AF + +[sendemail] +smtpserver = smtp.gmail.com +smtpuser = tobyv13@gmail.com +smtpencryption = tls +smtpserverport = 587 + +[commit] +gpgsign = true + +[init] +defaultBranch = main + +[pull] +rebase = true + +[merge] +ff = only + +[fetch] +prune = true + +[diff] +colorMoved = default + +[merge] +tool = nvimdiff + +[mergetool "nvimdiff"] +layout = "MERGED" + +[trailer] +separators = ":#" + +[trailer "fix"] +key = "Fix #" + +[filter "lfs"] +clean = git-lfs clean -- %f +smudge = git-lfs smudge -- %f +process = git-lfs filter-process +required = true + +[alias] +# basic +st = status -s +cl = clone +ci = commit +co = checkout +br = branch +r = reset +rv = remote -v +cp = cherry-pick +dev = checkout develop +main = checkout main + +# tweak defaults +grep = grep -Ii +diff = diff --word-diff +branch = branch -ra +ai = add --interactive +recommit = commit --amend -C HEAD +redate = rebase --committer-date-is-author-date + +# log commands +lg = log --graph --oneline --decorate --branches --remotes --tags --abbrev-commit +ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%an]" --decorate --date=relative +ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [a:%an,c:%cn]" --decorate --numstat +watch = "!f() { watch -c 'git -c color.ui=always lg | sed \"s/\\[m/\\[00m/\"'; }; f" + +# undo http://megakemp.com/2016/08/25/git-undo/ +undo = "!f() { git reset --soft $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f" +pop = git reset HEAD~ + +# rename branch +brn = "!f() { git branch -m \"$(git rev-parse --abbrev-ref HEAD)\" $1; git fetch origin; git branch -u origin/$1 $1; git remote set-head origin -a; }; f" + +# squash the last N commits, inclusivly +squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f" + +# grep on filename +ff = !git ls-files | grep -i + +# remove submodule +smrm = "!f(){ git rm --cached \"$1\";rm -r \"$1\";git config -f .gitmodules --remove-section \"submodule.$1\";git config -f .git/config --remove-section \"submodule.$1\";git add .gitmodules; }; f" + +# stash staged files +stashindex = !git stash --keep-index && git stash && git stash apply stash@{1} && git stash show -p | git apply -R && git stash drop stash@{1} + +# generate git artifacts +ignore = "!f() { IFS=\",\"; curl -L -s \"https://www.toptal.com/developers/gitignore/api/$*\" ;}; f" +attributes = "!f() { curl -sL https://gist.githubusercontent.com/tobyvin/70f3671c76016063594ea45edbb97094/raw ;}; f" +license = "!f() { curl -sH 'Accept: application/vnd.github.v3+json' https://api.github.com/licenses/$1 | grep -oP '.*\"body\":\\s*\"\\K.*(?=\\s*\",)' | tr '\\n' '\\0' | xargs -0 printf '%b\\n' | sed \"s/\\[year\\]/$(date +'%Y')/\" | sed \"s/\\[fullname\\]/$(git config --get user.name)/\"; }; f" -- cgit v1.2.3-70-g09d2