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