From 09513b5c4e4babfaefdd06c592ef34c0908dc572 Mon Sep 17 00:00:00 2001 From: sadbeast Date: Thu, 30 May 2024 00:47:47 +0000 Subject: oh god what have i done --- home/sadbeast/features/git.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 home/sadbeast/features/git.nix (limited to 'home/sadbeast/features/git.nix') diff --git a/home/sadbeast/features/git.nix b/home/sadbeast/features/git.nix new file mode 100644 index 0000000..477265b --- /dev/null +++ b/home/sadbeast/features/git.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + ... +}: { + programs.git = { + enable = true; + userName = lib.mkDefault config.home.username; + userEmail = lib.mkDefault "sadbeast@sadbeast.com"; + + aliases = { + p = "pull --ff-only"; + ff = "merge --ff-only"; + graph = "log --decorate --oneline --graph"; + add-nowhitespace = "!git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero -"; + # for "last branch", shows the most recently accessed branches + lb = "!git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 15 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'"; + }; + + extraConfig = { + init.defaultBranch = "main"; + push.autoSetupRemote = true; + # Reuse merge conflict fixes when rebasing + rerere.enabled = true; + }; + ignores = [".direnv"]; + }; +} -- cgit v1.2.3