-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.nix
More file actions
64 lines (61 loc) · 1.75 KB
/
git.nix
File metadata and controls
64 lines (61 loc) · 1.75 KB
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
{
config,
lib,
pkgs,
...
}:
let
cfg = config.home.sweet;
in
lib.mkIf cfg.enable {
programs.difftastic.git.enable = cfg.level == "extra";
programs.git = {
enable = true;
package = lib.mkDefault pkgs.gitFull;
ignores = [
".DS_Store"
".direnv"
"__pycache__"
];
settings = {
# 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";
};
settings.alias = {
a = "add .";
f = "fetch --all --prune";
rs = "reset";
rsh = "reset --hard";
c = "commit";
ce = "commit --amend";
ca = "commit --all";
caa = "commit --all --amend";
cea = "commit --all --amend";
cae = "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";
};
};
}