{
  #xdg.configFile = {
  #  "git/config".source = ./config;
  #  "git/ignore".source = ./ignore;
  #  "git/attributes".source = ./attributes;
  #};

  programs.lazygit.enable = true;

  programs.git = {
    enable = true;
    userName = "Anish Lakhwara";
    userEmail = "anish+git@lakhwara.com";
    delta.enable = true;
    # TODO enable signing

    ignores = [
      "*~"
      "*.*~"
      "\\#*"
      ".\\#*"
      "*.swp"
      ".*.sw[a-z]"
      "*.un~"
      ".netrwhist"
      ".vim/*"
      ".DS_Store?"
      ".DS_Store"
      ".CFUserTextEncoding"
      ".Trash"
      ".Xauthority"
      "thumbs.db"
      "Thumbs.db"
      "Icon?"
      ".ccls-cache/"
      ".sass-cache/"
      "__pycache__/"
      "*.class"
      "*.exe"
      "*.o"
      "*.pyc"
      "*.elc"
      ".nrepl-port"
      ".envrc"
      ".lsp/*"
      ".direnv/*"
      ".clj-kondo/*"
      ".cpcache/*"
      ".tmp"
      ".direnv"
      "result"
    ];

    extraConfig = {
      pull.rebase = false;
      push.autoSetupRemote = true;
      init.defaultBranch = "main";
    };

    aliases = {
      a = "add -p";
      co = "checkout";
      cob = "checkout -b";
      f = "fetch -p";
      c = "commit -v";
      p = "push";
      ba = "branch -a";
      bd = "branch -d";
      bD = "branch -D";
      d = "diff";
      dc = "diff --cached";
      ds = "diff --staged";
      r = "restore";
      rs = "restore --staged";
      st = "status -sb";

      # reset
      soft = "reset --soft";
      hard = "reset --hard";
      s1ft = "soft HEAD~1";
      h1rd = "hard HEAD~1";

      # logging
      lg =
        "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
      plog =
        "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
      tlog =
        "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
      rank = "shortlog -sn --no-merges";
      authors = "authors | sort | uniq -c | sort -n";
      ls = "log --graph --abbrev-commit --decorate --color=always --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim red)%an%C(reset)%C(bold yellow)%d%C(reset)' --all";

      # delete merged branches
      bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d";
    };
  };
}