{ lib, pkgs, ... }: { programs.git = { enable = true; settings = { user.name = "Alex Bates"; user.email = lib.mkDefault "alex@bates64.com"; aliases = { pu = "push"; co = "checkout"; cm = "commit"; sync = "submodule update --init --recursive"; }; core = { excludesfile = "~/.config/git/gitignore"; fsmonitor = true; untrackedCache = true; }; init = { defaultBranch = "main"; }; url = { "ssh://git@github/" = { insteadOf = "https://github/"; }; }; pull = { rebase = true; }; push = { autoSetupRemote = true; followTags = true; }; fetch = { prune = true; pruneTags = true; all = false; }; rebase = { autoSquash = true; autoStash = true; updateRefs = true; }; rerere = { enabled = true; autoupdate = true; }; merge.conflictstyle = "zdiff3"; commit.verbose = true; column.ui = "auto"; branch.sort = "-committerdate"; tag.sort = "version:refname"; help.autocorrect = "prompt"; }; maintenance.enable = true; }; home.file.".config/git/gitignore".source = ./gitignore; programs.gh = { enable = true; extensions = with pkgs; [ gh-poi # `gh poi` to delete local branches that have been merged ]; }; programs.jujutsu = { enable = true; settings = { user.name = "Alex Bates"; user.email = lib.mkDefault "alex@bates64.com"; ui.default-command = ["log" "--summary"]; ui.movement.edit = true; ui.editor = "zeditor --wait"; revsets.log = "present(@) | ancestors(@ ~ ::remote_bookmarks(), 2) | heads(::@ & bookmarks())"; fsmonitor.backend = "watchman"; fsmonitor.watchman.register-snapshot-trigger = true; revset-aliases."immutable_heads()" = "builtin_immutable_heads() | (trunk().. & ~mine())"; # make others commits immutable template-aliases."format_timestamp(timestamp)" = ''if(timestamp.before("1 year ago"), timestamp.format("%b %-d %Y"), timestamp.ago())''; template-aliases."format_short_signature(signature)" = ''coalesce(signature.name(), name_placeholder)''; template-aliases."builtin_log_compact(commit)" = '' if(commit.root(), format_root_commit(commit), label( separate(" ", if(commit.current_working_copy(), "working_copy"), if(commit.immutable(), "immutable", "mutable"), if(commit.conflict(), "conflicted"), ), separate(" ", format_short_change_id_with_change_offset(commit), if(commit.description(), commit.description().first_line(), label(if(commit.empty(), "empty"), description_placeholder), ), if(commit.empty(), empty_commit_marker), commit.bookmarks(), commit.tags(), commit.working_copies(), format_commit_labels(commit), if(!commit.mine(), format_short_signature(commit.author())), format_timestamp(commit_timestamp(commit)), ) ++ "\n", ) ) ''; }; }; home.packages = [ pkgs.watchman ]; # for programs.jujutsu.settings.fsmonitor.backend }