1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
{
config,
pkgs,
...
}: let
gitTemplateFile =
pkgs.writeText "git_template.git"
''
# Title: Summary, imperative, start upper case, don't end with a period
# If applied, this commit will <your Title>
# Body: Explain *what* and *why* (not *how*).
# BREAKING CHANGE: <description>
# Fixes: #
# Refs: #
# Co-authored-by: <name> <email>
# Convention Commits (https://www.conventionalcommits.org/en/v1.0.0/):
# feat: [Features] -> MINOR version bump
# A new feature
#
# fix: [Bug Fixes] -> PATCH version bump
# A bug fix
#
# append '!' after the type/scope: [Breaking Change] -> MAJOR version bump
# A breaking API change
#
# docs: [Documentation]
# Documentation only changes
#
# style: [Styles]
# Changes that do not affect the meaning of the code
# (white-space, formatting, missing semi-colons, etc)
#
# refactor: [Code Refactoring]
# A code change that neither fixes a bug nor adds a feature
#
# perf: [Performance Improvements] -> PATCH version bump
# A code change that improves performance
#
# test: [Tests]
# Adding missing tests or correcting existing tests
#
# build: [Builds] -> PATCH version bump
# Changes that affect the build system or external dependencies
# (example scopes: gulp, broccoli, npm)
#
# ci: [Continuous Integrations]
# Changes to our CI configuration files and scripts
# (example scopes: Travis, Circle, BrowserStack, SauceLabs)
#
# chore: [Chores]
# Other changes that don't modify src or test files
#
# reverts: [Reverts]
# Reverts a previous commit
# How to Write a Git Commit Message:
# [https://chris.beams.io/posts/git-commit/] -> https://cbea.ms/git-commit/
#
# 1. Separate subject from body with a blank line
# 2. Limit the subject line to 50 characters
# 3. Capitalize the subject line
# 4. Do not end the subject line with a period
# 5. Use the imperative mood in the subject line
# 6. Wrap the body at 72 characters
# 7. Use the body to explain *what* and *why* vs. *how*
'';
gitConfig = {
init = {
defaultBranch = "prime";
};
credential = {
helper = "cache --timeout 43200";
};
user = {
email = "ene@sils.li";
name = "ene";
};
help = {
autocorrect = 5;
};
commit = {
template = "${gitTemplateFile}";
};
};
in {
programs.git = {
enable = true;
#package = pkgs.gitAndTools.gitFull; # TODO for git send-email support
aliases = {
st = "status";
ds = "diff --staged";
## Logging:
ls = "log --max-count=10 --color --format=format:'%C(bold red)%h%C(reset) %C(dim bold blue)%s%C(reset) %C(dim white)[%aN]' ";
# https://stackoverflow.com/a/61487052
lg = "lg1";
lg1 = "lg1-specific --all";
lg2 = "lg2-specific --all";
lg3 = "lg3-specific --all";
lg1-specific = "log --graph --abbrev-commit --decorate \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'";
lg2-specific = "log --graph --abbrev-commit --decorate \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'";
lg3-specific = "log --graph --abbrev-commit --decorate \
--format=format:'%C(bold blue)%h%C(reset)\
- %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)\
%C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n\
'' %C(white)%s%C(reset)%n'' \
%C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'";
};
extraConfig = gitConfig;
delta = {
enable = true;
options = {
decorations = {
commit-decoration-style = "bold yellow box ul";
file-decoration-style = "none";
file-style = "bold yellow ul";
};
features = "decorations";
whitespace-error-style = "22 reverse";
};
};
# signing = {
# key = null; #let gpg2 decide, based on the author
# signByDefault = true;
# };
};
}
# vim: ts=2
|