2022-01-10 19:30:22 +00:00
|
|
|
{ ... }: {
|
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
userName = "Sam Willcocks";
|
|
|
|
userEmail = "sam@wlcx.cc";
|
|
|
|
|
|
|
|
delta = { # Better diffs
|
|
|
|
enable = true;
|
|
|
|
options = { line-numbers = true; };
|
|
|
|
};
|
|
|
|
|
|
|
|
aliases = {
|
|
|
|
a = "add";
|
|
|
|
ap = "add -p";
|
|
|
|
c = "commit";
|
2022-01-12 17:37:06 +00:00
|
|
|
ca = "commit --amend";
|
2022-01-10 19:30:22 +00:00
|
|
|
can = "commit --amend --no-edit";
|
|
|
|
cm = "commit -m";
|
|
|
|
co = "checkout";
|
|
|
|
d = "diff";
|
|
|
|
dc = "diff --cached";
|
|
|
|
l = "log";
|
|
|
|
lp = "log --patch";
|
2022-02-28 23:44:43 +00:00
|
|
|
p = "push";
|
|
|
|
pf = "push --force-with-lease";
|
2022-01-10 19:30:22 +00:00
|
|
|
r = "rebase";
|
|
|
|
rc = "rebase --continue";
|
|
|
|
ra = "rebase --autostash";
|
|
|
|
rai = "rebase --autostash --interactive";
|
2022-03-10 23:25:15 +00:00
|
|
|
rs = "restore --staged";
|
2022-01-10 19:30:22 +00:00
|
|
|
st = "status";
|
2022-06-13 16:41:32 +01:00
|
|
|
sw = "switch";
|
|
|
|
swc = "switch --create";
|
2022-01-10 19:30:22 +00:00
|
|
|
|
|
|
|
gone = ''
|
2022-01-17 18:26:25 +00:00
|
|
|
! git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' │ awk '$2 == "[gone]" {print $1}' | xargs -r git branch -D'';
|
2022-01-10 19:30:22 +00:00
|
|
|
};
|
|
|
|
extraConfig = {
|
|
|
|
branch.sort = "-committerdate";
|
|
|
|
push.default = "current";
|
2022-02-28 23:44:43 +00:00
|
|
|
init.defaultBranch = "main";
|
2022-01-10 19:30:22 +00:00
|
|
|
};
|
2022-01-14 16:19:05 +00:00
|
|
|
includes = [
|
2022-03-09 13:03:32 +00:00
|
|
|
# Always include local gitconfig if it's there
|
|
|
|
{
|
|
|
|
path = "~/.gitconfig.local";
|
|
|
|
}
|
|
|
|
# Include work gitconfig if we're somewhere in ~/work
|
2022-01-17 18:26:25 +00:00
|
|
|
{
|
|
|
|
path = "~/.gitconfig.work";
|
|
|
|
condition = "gitdir:~/work/";
|
|
|
|
}
|
2022-01-14 16:19:05 +00:00
|
|
|
];
|
2022-01-10 19:30:22 +00:00
|
|
|
};
|
|
|
|
}
|