]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/git.nix
ssh: rename { networking/ssh => ssh }
[julm/julm-nix.git] / home-manager / profiles / git.nix
1 { pkgs, lib, ... }:
2 {
3 home.packages = [
4 pkgs.git-chglog
5 pkgs.git-crypt
6 pkgs.git-filter-repo
7 pkgs.git-quick-stats
8 ];
9 programs.git = {
10 enable = true;
11 ignores = [ "*~" "*.swp" ];
12 package = lib.mkDefault pkgs.gitMinimal;
13 aliases = {
14 a = "add";
15 ap = "add -p";
16 authors = "shortlog -s -n";
17 bl = "git log -p -M --follow --stat --";
18 b = "branch";
19 c = "commit";
20 ca = "commit --amend";
21 caa = "commit --amend -C@";
22 caaa = "commit --amend -C@ -a";
23 cf = "commit --fixup";
24 co = "checkout";
25 d = "diff";
26 dc = "diff --cached";
27 dh = "diff --histogram";
28 dp = "diff --patience";
29 g = "grep";
30 ign = "ls-files -o -i --exclude-standard";
31 l = "log";
32 ll = "log --graph --decorate --pretty=oneline --abbrev-commit";
33 lp = "log -p --pretty=fuller";
34 lpg = "log -p --pretty=fuller -g";
35 p = "push -v";
36 pf = "push -vf";
37 pu = "pull";
38 r = "reset";
39 rh = "reset --hard";
40 ri = "rebase -i";
41 rp = "reset -p";
42 s = "status";
43 spull = "!git-svn fetch && git-svn rebase";
44 spush = "!git-svn dcommit";
45 ss = "status -s";
46 st = "status -uno";
47 sw = "switch";
48 fetch-local = "!git fetch local && git tag -d $(git describe --exact-match 2>/dev/null >/dev/null) && git fetch --tags local";
49 pull-local = "!git fetch-local && git checkout -B master local/master";
50 pull-local-old = "!git fetch-local && git checkout HEAD'^' && git branch -f master local/master && git checkout master";
51 root = ''!git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"'';
52 has-tag-version = ''!git show-ref --tags -d | grep -qx \"^$(git rev-parse HEAD) refs/tags/v[0-9][0-9][0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\(\\^{}\\)\\?\"'';
53 tag-version = ''"!git has-tag-version && return; v=$(TZ=UTC date +v%Y-%m-%d) && name=$(git rev-parse --show-toplevel | sed -e 's:^.*/work::') && set -x && git tag -s -m \"$name $v\" $v"'';
54 has-tag-majordate = ''!git show-ref --tags -d | grep -qx \"^$(git rev-parse HEAD) refs/tags/v[0-9]\\+.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\\(\\^{}\\)\\?\"'';
55 tag-majordate = ''"!git has-tag-majordate && return; name=$(basename $(dirname $(git rev-parse --show-toplevel))); major=$(basename $(git rev-parse --show-toplevel)); version=''${version:-$(TZ=UTC date +\"v$major.%Y%m%d\")} && set -x && git tag -s -m \"$name $version\" $version"'';
56 tag-cabal = ''"!set -x; for cabal in $(git ls-files | grep '.*\\.cabal$'); do name=$(sed -ne 's/^name: *\\(.*\\)/\\1/p' \"$cabal\"); version=$(sed -ne 's/^version: *\\(.*\\)/\\1/p' \"$cabal\"); git tag --merged | grep -Fqx \"$name-$version\" || git tag -f -s -m \"$name v$version\" $name-$version; done"'';
57 cl = "notes --ref=changelog append";
58 cl-bug = "notes --ref=changelogs/bugs append";
59 cl-feature = "notes --ref=changelogs/features append";
60 wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
61 };
62 extraConfig = {
63 push.default = "simple";
64 color.diff = "auto";
65 #color.diff.whitespace = "red reverse";
66 color.status = "auto";
67 color.branch = "auto";
68 core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
69 core.quotepath = "false";
70 diff.algorithm = "histogram";
71 diff.sqldiff.command = "sqldiff";
72 format.pretty = "oneline";
73 init.defaultBranch = "main";
74 web.browser = "elinks";
75 browser.elinks.cmd = "elinks";
76 sendemail.chainReplyTo = "false";
77 sendemail.composeencoding = "UTF-8";
78 sendemail.confirm = "always";
79 sendemail.envelopeSender = "auto";
80 sendemail.multiedit = "yes";
81 sendemail.suppresscc = "self";
82 sendemail.suppressFrom = "false";
83 sendemail.thread = "true";
84 sendemail.validate = "true";
85 merge.tool = "vimdiff";
86 protocol.version = 2;
87 pull.rebase = true;
88 rebase.autosquash = "true";
89 };
90 };
91 }