dotfiles/home/.gitconfig
Marcus Noble c44a00fbcb
Ensure git publish uses fork remote if found
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-06-20 08:50:31 +01:00

67 lines
2.1 KiB
INI
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[user]
name = Marcus Noble
email = github@marcusnoble.co.uk
signingkey = B8F2DB8A7AEBAF78
[commit]
gpgsign = true
[core]
editor = /usr/bin/vim
excludesfile = ~/.gitignore
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[delta]
line-numbers = true
side-by-side = true
[push]
default = simple
[init]
defaultBranch = main
[credential]
helper = store
[color]
ui = true
[color "diff"]
old = red strike
new = green italic
[alias]
basename = "!git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\\///' | sed 's/\\.git//'"
org-name = "!git remote -v | grep -m 1 -o ':.*/' | sed 's:^.\\(.*\\).$:\\1:'"
branch-name = "!git rev-parse --abbrev-ref HEAD"
changelog-changed = "!test $(git diff --name-only HEAD origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') | grep CHANGELOG.md | wc -l | xargs) = 1"
main-branch = "!git remote show origin|grep HEAD|sed 's/.* //'"
fork-or-origin = "!func(){ $(git remote show fork &>/dev/null); if [[ $? == 0 ]]; then echo \"fork\" ; else echo \"origin\"; fi; }; func"
main = "!git remote set-head origin --auto && git checkout $(git main-branch) && git pull"
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u $(git fork-or-origin) $(git branch-name) && (git changelog-changed || echo '\n\n⚠ Dont forget to update changelog ⚠️ ') ; else echo "Wat?!"; fi; }; func"
cleanup = "!git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done"
dont-change-file = "!git update-index --assume-unchanged"
ignore-file = "!git update-index --skip-worktree"
remember-file = "!git update-index --no-skip-worktree"
logg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
dif = "!git diff -w"
pop = "!git stash pop"
[help]
autocorrect = 1
[diff]
compactionHeuristic = true
[url "ssh://git@github.com"]
insteadOf = https://github.com
[pull]
rebase = false
[gpg]
program = /opt/homebrew/bin//gpg