-{ pkgs, lib, ... }:
{
- home.packages = [
+ pkgs,
+ lib,
+ config,
+ ...
+}:
+{
+ home.packages = lib.mkIf config.programs.git.enable [
pkgs.b4
pkgs.delta
pkgs.difftastic
+ pkgs.gh
+ pkgs.git-absorb
+ pkgs.git-bug
pkgs.git-chglog
pkgs.git-cliff
pkgs.git-crypt
+ pkgs.git-extras
pkgs.git-filter-repo
#pkgs.git-publish
pkgs.git-quick-stats
pkgs.gitui
+ #pkgs.radicle-node
pkgs.tig
];
programs.git = {
- enable = true;
- ignores = [ "*~" "*.swp" ];
+ enable = lib.mkDefault true;
+ ignores = [
+ "*~"
+ "*.swp"
+ ];
package = lib.mkDefault pkgs.gitMinimal;
aliases = {
a = "add";
+ ai = "add --intent-to-add";
+ ab = "absorb";
+ abr = "absorb -r";
ap = "add -p";
+ au = "add -u";
authors = "shortlog -s -n";
- bl = "git log -p -M --follow --stat --";
b = "branch";
+ bl = "git log -p -M --follow --stat --";
c = "commit";
ca = "commit --amend";
caa = "commit --amend -C@";
ign = "ls-files -o -i --exclude-standard";
l = "log";
ll = "log --graph --decorate --pretty=oneline --abbrev-commit";
- lp = "log -p --pretty=fuller";
- lpg = "log -p --pretty=fuller -g";
+ lp = "log -p --pretty=fuller --stat";
+ lpg = "log -p --pretty=fuller --stat -g";
p = "push -v";
- pf = "push -vf";
- pu = "pull";
+ pa = "patch";
+ patch = "push rad HEAD:refs/patches";
+ # See https://stackoverflow.com/a/65839129/6741004
+ pf = "push -v --force-with-lease --force-if-includes";
+ pl = "pull";
r = "reset";
+ repack-1 = "git repack -a -d -f --depth=1 --window=1";
+ repack-250 = "git repack -a -d -f --depth=250 --window=250";
rh = "reset --hard";
ri = "rebase -i";
rp = "reset -p";
spush = "!git-svn dcommit";
ss = "status -s";
st = "status -uno";
+ stu = "status -unormal";
sw = "switch";
fetch-local = "!git fetch local && git tag -d $(git describe --exact-match 2>/dev/null >/dev/null) && git fetch --tags local";
pull-local = "!git fetch-local && git checkout -B master local/master";
wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
};
extraConfig = {
- browser.elinks.cmd = "elinks";
+ branch.sort = "-committerdate";
color.branch = "auto";
color.diff = "auto";
#color.diff.whitespace = "red reverse";
color.status = "auto";
+ column.ui = "auto";
+ commit.verbose = true;
+ #core.fsmonitor true
+ #core.untrackedCache true
core.commentChar = "auto";
core.quotepath = "false";
core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
diff.algorithm = "histogram";
+ diff.colorMoved = "plain";
+ diff.mnemonicPrefix = true;
+ diff.renames = true;
diff.sqldiff.command = "sqldiff";
+ fetch.prune = true;
+ fetch.pruneTags = true;
+ fetch.all = true;
format.pretty = "oneline";
gui.fontdiff = ''-family "DejaVu Sans Mono" -size 8 -weight normal -slant roman -underline 0 -overstrike 0'';
gui.fontui = ''-family "DejaVu Sans" -size 8 -weight normal -slant roman -underline 0 -overstrike 0'';
cmd = "EDITOR=gvim git rebase -i $REVISION";
revprompt = true;
};
+ help.autocorrect = "prompt";
init.defaultBranch = "main";
merge.tool = "vimdiff";
+ merge.conflictStyle = "zdiff3";
protocol.version = 2;
pull.rebase = true;
+ push.autoSetupRemote = true;
push.default = "simple";
- rebase.autosquash = "true";
+ push.followTags = true;
+ push.useForceIfIncludes = true;
+ rebase.autoSquash = true;
+ rebase.autoStash = true;
+ rebase.updateRefs = true;
+ rerere.autoupdate = true;
+ rerere.enabled = true;
sendemail.chainReplyTo = "false";
sendemail.composeencoding = "UTF-8";
sendemail.confirm = "always";
sendemail.suppresscc = "self";
sendemail.thread = "true";
sendemail.validate = "true";
+ tag.sort = "version:refname";
web.browser = "elinks";
};
iniContent = {
/*
- diff.external = lib.concatStringsSep " " [
- "${pkgs.difftastic}/bin/difft"
- "--color auto"
- "--background dark"
- "--display side-by-side"
- ];
+ diff.external = lib.concatStringsSep " " [
+ "${pkgs.difftastic}/bin/difft"
+ "--color auto"
+ "--background dark"
+ "--display side-by-side"
+ ];
*/
# difftastic
/*
- diff.tool = "difftastic";
- difftool.prompt = false;
- difftool.difftastic.cmd = ''${pkgs.difftastic}/bin/difft "$LOCAL" "$REMOTE"'';
- pager.difftool = true;
+ diff.tool = "difftastic";
+ difftool.prompt = false;
+ difftool.difftastic.cmd = ''${pkgs.difftastic}/bin/difft "$LOCAL" "$REMOTE"'';
+ pager.difftool = true;
*/
# delta
/*
- core.pager = "delta";
- interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only --features=interactive";
- delta.features = "decorations";
- delta.interactive = {
- keep-plus-minus-markers = false;
- };
- delta.decorations = {
- commit-decoration-style = "blue ol";
- commit-style = "raw";
- file-style = "omit";
- hunk-header-decoration-style = "blue box";
- hunk-header-file-style = "red";
- hunk-header-line-number-style = "#067a00";
- hunk-header-style = "file line-number syntax";
- };
+ core.pager = "delta --grep-separator-symbol keep";
+ interactive.diffFilter = "delta --color-only --features=interactive";
+ delta.features = "decorations";
+ delta.interactive = {
+ keep-plus-minus-markers = false;
+ };
+ delta.decorations = {
+ commit-decoration-style = "blue ol";
+ commit-style = "raw";
+ file-style = "omit";
+ hunk-header-decoration-style = "blue box";
+ hunk-header-file-style = "red";
+ hunk-header-line-number-style = "#067a00";
+ hunk-header-style = "file line-number syntax";
+ };
*/
};
};
- programs.bash = {
+ programs.bash = lib.mkIf config.programs.git.enable {
shellAliases = {
g = "git";
ge = "git-edit-commit";