]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/git.nix
yt-dlp: fix typo
[julm/julm-nix.git] / home-manager / profiles / git.nix
1 { pkgs, lib, config, ... }:
2 {
3 programs.git = {
4 enable = true;
5 ignores = [ "*~" "*.swp" ];
6 package = pkgs.gitFull;
7 aliases = {
8 authors = "shortlog -s -n";
9 bl = "git log -p -M --follow --stat --";
10 br = "branch";
11 ci = "commit";
12 ca = "commit --amend -C@";
13 co = "checkout";
14 dc = "diff --cached";
15 df = "diff";
16 dh = "diff --histogram";
17 dp = "diff --patience";
18 ign = "ls-files -o -i --exclude-standard";
19 ll = "log --graph --decorate --pretty=oneline --abbrev-commit";
20 lp = "log -p";
21 s = "status -s";
22 spull = "!git-svn fetch && git-svn rebase";
23 spush = "!git-svn dcommit";
24 st = "status";
25 su = "status -uno";
26 fetch-local = "!git fetch local && git tag -d $(git describe --exact-match 2>/dev/null >/dev/null) && git fetch --tags local";
27 pull-local = "!git fetch-local && git checkout -B master local/master";
28 pull-local-old = "!git fetch-local && git checkout HEAD'^' && git branch -f master local/master && git checkout master";
29 root = ''!git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"'';
30 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]\\(\\^{}\\)\\?\"'';
31 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"'';
32 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]\\(\\^{}\\)\\?\"'';
33 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"'';
34 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"'';
35 cl = "notes --ref=changelog append";
36 cl-bug = "notes --ref=changelogs/bugs append";
37 cl-feature = "notes --ref=changelogs/features append";
38 wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
39 };
40 extraConfig = {
41 push.default = "simple";
42 color.diff = "auto";
43 #color.diff.whitespace = "red reverse";
44 color.status = "auto";
45 color.branch = "auto";
46 core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
47 core.quotepath = "false";
48 diff.algorithm = "histogram";
49 diff.sqldiff.command = "sqldiff";
50 format.pretty = "oneline";
51 init.defaultBranch = "main";
52 web.browser = "elinks";
53 browser.elinks.cmd = "elinks";
54 sendemail.chainReplyTo = "false";
55 sendemail.composeencoding = "UTF-8";
56 sendemail.confirm = "always";
57 sendemail.envelopeSender = "auto";
58 sendemail.multiedit = "yes";
59 sendemail.suppresscc = "self";
60 sendemail.suppressFrom = "false";
61 sendemail.thread = "true";
62 sendemail.validate = "true";
63 merge.tool = "vimdiff";
64 protocol.version = 2;
65 pull.rebase = true;
66 rebase.autosquash = "true";
67 };
68 };
69 }