-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.nix
56 lines (55 loc) · 1.55 KB
/
git.nix
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
{
config,
lib,
pkgs,
...
}:
let
cfg = config.home.sweet;
in
lib.mkIf cfg.enable {
programs.git = {
enable = true;
package = pkgs.gitFull;
difftastic.enable = cfg.level == "extra";
ignores = [
".DS_Store"
".direnv"
"__pycache__"
];
extraConfig = {
# https://jvns.ca/blog/2024/02/16/popular-git-config-options/
init.defaultBranch = "master";
push.autoSetupRemote = true;
pull.ff = "only";
rebase.autostash = true;
help.autocorrect = 10;
merge.tool = "vscode";
diff.tool = "nvimdiff";
diff.guitool = "vscode";
"mergetool \"vscode\"".cmd = "code --wait --merge $REMOTE $LOCAL $BASE $MERGED";
"difftool \"vscode\"".cmd = "code --wait --diff $LOCAL $REMOTE";
"difftool \"difftastic\"".cmd = "${pkgs.difftastic}/bin/difft $LOCAL $REMOTE";
};
aliases = {
a = "add .";
c = "commit";
ca = "commit --amend";
caa = "commit --all --amend";
cl = "clone --recurse-submodules";
co = "checkout";
ps = "push";
pl = "pull --rebase --prune";
st = "status";
br = "branch";
sw = "switch";
s = "commit -m '[WIP] A tempereary commit, should be squashed later'";
sa = "s -a";
re = "rebase -i HEAD~10";
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
vidiff = "difftool --tool nvimdiff";
vsdiff = "difftool --tool vscode";
difft = "difftool --tool difftastic";
};
};
}