From d88996e01d9d1c9c5afb930ea2944dcf2adfa884 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 27 Feb 2025 01:04:39 +0100 Subject: [PATCH] Better git config --- modules/cli/tools/git.nix | 51 ++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/modules/cli/tools/git.nix b/modules/cli/tools/git.nix index 4831596..1826c94 100644 --- a/modules/cli/tools/git.nix +++ b/modules/cli/tools/git.nix @@ -29,20 +29,49 @@ ''; }; extraConfig = { - gpg.format = "ssh"; - gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers"; - push.autoSetupRemote = true; - push.default = "upstream"; + gpg = { + format = "ssh"; + ssh.allowedSignersFile = "~/.ssh/allowed_signers"; + }; + fetch = { + prune = true; + pruneTags = true; + all = true; + }; + push = { + default = "upstream"; + autoSetupRemote = true; + }; pull.ff = "only"; init.defaultBranch = "master"; - advice.diverging = false; - rerere.enabled = true; - rebase.updateRefs = true; - rebase.autoStash = true; - rebase.autoSquash = true; branch.sort = "-committerdate"; - # Disable hooks - core.hookspath = "/dev/null"; + tag.sort = "version:refname"; + advice.diverging = false; + rerere = { + enabled = true; + autoupdate = true; + }; + rebase = { + updateRefs = true; + autoStash = true; + autoSquash = true; + }; + diff = { + # newer & better diff algo, why is this not the default? + algorithm = "histogram"; + colorMoved = "plain"; + renames = true; + # use actually understandable prefixes (c/, i/ & w/) instead of a/ b/ + mnemonicPrefix = true; + }; + # show diff in commit window + commit.verbose = true; + core = { + # Disable hooks (i think i need to run it on each repo too, idk) + hookspath = "/dev/null"; + fsmonitor = true; + untrackedCache = true; + }; # Break compat with older versions of git (and systems that doesn't support mtime) to have better performances feature.manyFiles = true; };