From 2e963fa29e4a917a7b0d7436ab4a04fe2c52d73b Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Mon, 15 May 2023 15:49:10 +0300 Subject: [PATCH] Feat(config): Deduplicate git config, add special --- config/git/config | 58 ++-------------------------------- config/git/shared | 62 +++++++++++++++++++++++++++++++++++++ config/git/special/dotfiles | 2 ++ hosts/v/config/git/config | 59 ++--------------------------------- 4 files changed, 70 insertions(+), 111 deletions(-) create mode 100644 config/git/shared create mode 100644 config/git/special/dotfiles diff --git a/config/git/config b/config/git/config index 0be4d70..746f36b 100644 --- a/config/git/config +++ b/config/git/config @@ -1,59 +1,7 @@ +[include] + path = ~/.dotfiles/config/git/shared + [user] name = Ismo Vuorinen email = ismo@ivuorinen.net -[credential] - helper = store --file ~/.cache/git/git-credentials - helper = cache --timeout 30000 - -[core] - excludesfile = ~/.config/git/gitignore - -[alias] - reset-origin = !git fetch origin && git reset --hard origin/master && git clean -f -d - reset-upstream = !git fetch upstream && git reset --hard upstream/master && git clean -f -d - nah = !git reset --hard && git clean -df - undo-commit = reset HEAD~ --soft - llog = log --pretty=fuller - logs = log --graph --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) %C(cyan)<%an>%Creset' --abbrev-commit - rl = reflog --format='%C(auto)%h %<|(20)%gd %C(blue)%cr%C(reset) %gs (%s)' - tagdate = log --date-order --graph --tags --simplify-by-decoration --pretty=format:\"%ai %h %d\" - branchbydate = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' - branchcolor = "!for ref in $(git for-each-ref --sort=-committerdate --format=\"%(refname)\" refs/heads/ refs/remotes ); do git log -n1 $ref --pretty=format:\"%Cgreen%cr%Creset %C(yellow)%d%Creset %C(bold blue)<%an>%Creset%n\" | cat ; done | awk '! a[$0]++'" - -[diff] - tool = difftastic - -[difftool] - prompt = false - -[difftool "difftastic"] - cmd = difft "$LOCAL" "$REMOTE" - -[filter "lfs"] - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process - required = true - -[init] - defaultBranch = main - -[pull] - rebase = true - -[color] - ui = true - diff = auto - branch = auto - status = auto - -[color "status"] - added = green bold - changed = yellow - deleted = red bold strike - untracked = cyan - branch = yellow black bold ul - -[submodule] - recurse = true diff --git a/config/git/shared b/config/git/shared new file mode 100644 index 0000000..3805aa8 --- /dev/null +++ b/config/git/shared @@ -0,0 +1,62 @@ +[credential] + helper = store --file ~/.cache/git/git-credentials + helper = cache --timeout 30000 + +[core] + excludesfile = ~/.config/git/gitignore + +[init] + defaultBranch = main + +[pull] + rebase = true + +[gpg] + format = ssh + +[alias] + branchbydate = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' + branchcolor = "!for ref in $(git for-each-ref --sort=-committerdate --format=\"%(refname)\" refs/heads/ refs/remotes ); do git log -n1 $ref --pretty=format:\"%Cgreen%cr%Creset %C(yellow)%d%Creset %C(bold blue)<%an>%Creset%n\" | cat ; done | awk '! a[$0]++'" + llog = log --pretty=fuller + logs = log --graph --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) %C(cyan)<%an>%Creset' --abbrev-commit + nah = !git reset --hard && git clean -df + reset-origin = !git fetch origin && git reset --hard origin/master && git clean -f -d + reset-upstream = !git fetch upstream && git reset --hard upstream/master && git clean -f -d + rl = reflog --format='%C(auto)%h %<|(20)%gd %C(blue)%cr%C(reset) %gs (%s)' + tagdate = log --date-order --graph --tags --simplify-by-decoration --pretty=format:\"%ai %h %d\" + undo-commit = reset HEAD~ --soft + +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true + +[diff] + tool = difftastic + +[difftool] + prompt = false + +[difftool "difftastic"] + cmd = difft "$LOCAL" "$REMOTE" + +[color] + ui = true + diff = auto + branch = auto + status = auto + +[color "status"] + added = green bold + changed = yellow + deleted = red bold strike + untracked = cyan + branch = yellow black bold ul + +[submodule] + recurse = true + +# dotfiles special config +[includeIf "hasconfig:remote.*.url:https://github.com/ivuorinen/dotfiles.git"] + path = ~/.dotfiles/config/git/special/dotfiles ; diff --git a/config/git/special/dotfiles b/config/git/special/dotfiles new file mode 100644 index 0000000..dc24bfc --- /dev/null +++ b/config/git/special/dotfiles @@ -0,0 +1,2 @@ +[submodule] + recurse = false diff --git a/hosts/v/config/git/config b/hosts/v/config/git/config index 745eb79..78617d6 100644 --- a/hosts/v/config/git/config +++ b/hosts/v/config/git/config @@ -1,60 +1,11 @@ +[include] + path = ~/.dotfiles/config/git/shared + [user] name = Ismo Vuorinen email = ismo.vuorinen@vincit.fi signingkey = ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDLyOvkr1nRqMVv3UAizmk6C+q40H4khvw7qIXXXyOyFmzjwYx/Cuxoi4uZVjX+q4qFYJ+c312uu6YXiEtfyoCao3wub8r1cLBQ3eIvuyWp2K8Ixcd9JmFmLmoeiENpJxqyr0WPZLDkrCWUZCsQQh8zzGFnfciUdUdTiZ7s21AEhhmFRSdFlVfQSlGMFxU321psg1YilcP80bDwFd1FsL4TssSkwlbgP/twqnpZ4436TTo7kp0UnH/RZkfRdDWScKHaWgncBG0CZeQxGWnRp8fvZn/7gDnthcZhvnDALVBE7QFuZ90GxqVw3IGpHryV0mFO6EGQ9Ke9YX7pKVZPUXZjeCN4SVKsqFdVJ6AjaSJ9K7nL98rYK7qNzndT3cKqPNgPteyXWRulH68A51ecQqHrjTttZcdN9hKt9uBHpzuXsby2QObT+VB4MNjZapa+YYF/WgwJCml4lzn2xMFg1vYZD78pfoJ9e5f2cL1MMlUSDb0TNxmEXfDQ77H/pRpKDz0= -[core] - excludesfile = ~/.config/git/gitignore - -[alias] - reset-origin = !git fetch origin && git reset --hard origin/master && git clean -f -d - reset-upstream = !git fetch upstream && git reset --hard upstream/master && git clean -f -d - nah = !git reset --hard && git clean -df - undo-commit = reset HEAD~ --soft - llog = log --pretty=fuller - logs = log --graph --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) %C(cyan)<%an>%Creset' --abbrev-commit - rl = reflog --format='%C(auto)%h %<|(20)%gd %C(blue)%cr%C(reset) %gs (%s)' - tagdate = log --date-order --graph --tags --simplify-by-decoration --pretty=format:\"%ai %h %d\" - branchbydate = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' - branchcolor = "!for ref in $(git for-each-ref --sort=-committerdate --format=\"%(refname)\" refs/heads/ refs/remotes ); do git log -n1 $ref --pretty=format:\"%Cgreen%cr%Creset %C(yellow)%d%Creset %C(bold blue)<%an>%Creset%n\" | cat ; done | awk '! a[$0]++'" - -[diff] - tool = difftastic - -[difftool] - prompt = false - -[difftool "difftastic"] - cmd = difft "$LOCAL" "$REMOTE" - -[filter "lfs"] - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process - required = true - -[init] - defaultBranch = main - -[pull] - rebase = true - -[color] - ui = true - diff = auto - branch = auto - status = auto - -[color "status"] - added = green bold - changed = yellow - deleted = red bold strike - untracked = cyan - branch = yellow black bold ul - -[gpg] - format = ssh - [gpg "ssh"] program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign allowedSignersFile = ~/.ssh/allowed_signers @@ -69,7 +20,3 @@ [credential "https://gist.github.com"] helper = helper = !/opt/homebrew/bin/gh auth git-credential - -[submodule] - recurse = true -