config/users/pbsds/home/profiles/git.nix

74 lines
2.3 KiB
Nix

{ pkgs, ... }:
{
home.packages = with pkgs; [
#git
gh
hub
tea
colordiff
];
#programs.gh.enable = true; # adds read-only config to .config
#programs.git.gitui.enable = true;
programs.git.enable = true;
programs.git.lfs.enable = true;
programs.git.delta.enable = true;
programs.git.delta.options.max-line-length = 2000;
#programs.git.lfs.enable = true;
#programs.git.signing
#programs.git.userName = "pbsds"
programs.git.userName = "Peder Bergebakken Sundt";
programs.git.userEmail = "pbsds@hotmail.com";
# https://jvns.ca/blog/2024/02/16/popular-git-config-options/
programs.git.extraConfig.rerere.enabled = true;
#programs.git.extraConfig.help.autocorrect = "prompt";
programs.git.extraConfig.transfer.fsckobjects = true;
programs.git.extraConfig.fetch.fsckobjects = true;
programs.git.extraConfig.receive.fsckObjects = true;
programs.git.extraConfig.branch.sort = "-committerdate";
programs.git.extraConfig.tag.sort = "taggerdate";
programs.git.extraConfig.fetch.prune = true;
programs.git.extraConfig.fetch.prunetags = true;
programs.git.extraConfig.log.date = "iso";
/* programs.git.extraConfig.interactive.singleKey = true; */
programs.git.iniContent.init.defaultBranch = "main";
programs.git.ignores = [
#".envrc"
".remote.toml"
".remoteenv"
"result"
"result-*"
"results"
"results-*"
"__pycache__"
"*.pyc"
];
home.shellAliases = {
# git gud
gs = "git status";
gl = "git log --oneline --color | head -n 30";
glg = "git log --all --decorate --oneline --graph";
gpra = "git pull --rebase --autostash";
gd = "git diff";
gdwd = "git diff --word-diff";
gdwdr = "git diff --word-diff --word-diff-regex=.";
gds = "git diff --staged";
gdswd = "git diff --staged --word-diff";
gdswdr = "git diff --staged --word-diff --word-diff-regex=.";
gcp = "git cherry-pick";
gca = "git commit --amend";
gcara = "git commit --amend --reset-author";
gfr = "git pull --rebase";
gc = "git branch | cut -c2- | gum choose | xargs git checkout";
gbrm = "git fetch origin; git branch --merged | cut -c3- | grep -vE '^(main|master)$' | gum choose --no-limit --header 'Which branches to delete:' | xargs git branch -D";
#gb = "git blame";
#gpo = "git push origin";
};
}