dotfiles/nix/modules/home-manager/features/cli/git.nix

155 lines
4.4 KiB
Nix
Raw Normal View History

{ pkgs, ... }:
2023-11-06 23:48:09 +00:00
{
home.file.".gitmessage".text = ''
2023-12-17 20:29:39 +00:00
2023-11-06 23:48:09 +00:00
# Description
#
# - Why is this change necessary?
# - How does it address the issue?
# - What side effects does this change have?
#
2023-12-18 11:31:23 +00:00
# For breaking changes, uncomment the following line and describe the change:
2023-11-06 23:48:09 +00:00
#
# BREAKING CHANGE:
#
#
# Add any issue IDs or commit SHAs that this commit references:
#
# Refs:
'';
2024-01-25 08:12:33 +00:00
programs = {
git = {
enable = true;
userName = "Oliver Davies";
2024-01-29 13:10:21 +00:00
userEmail = "oliver@oliverdavies.dev";
2023-11-06 23:48:09 +00:00
includes = [
{
2024-09-23 09:46:41 +00:00
condition = "gitdir:~/Code/tfw";
contents.user.email = "oliver.davies@tfw.wales";
}
];
2024-01-25 08:12:33 +00:00
aliases = {
aa = "add --all";
assume = "update-index --assume-unchanged";
assumed = "!git ls-files -v | grep '^[hsmrck?]' | cut -c 3-";
b = "branch";
blame = "blame -w -C -C -C";
2024-01-25 08:12:33 +00:00
browse = "!gh repo view --web";
ca = "commit --amend --verbose";
car = "commit --amend --no-edit";
cl = "!hub clone";
co = "checkout";
compare = "!hub compare";
current-branch = "rev-parse --abbrev-ref HEAD";
dc = "diff --color --word-diff --cached";
df = "diff --color --word-diff";
dup = "!git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -";
2024-01-25 08:12:33 +00:00
fixup = "commit --fixup";
issues = "!gh issue list --web";
mup = "!git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -";
2024-01-25 08:12:33 +00:00
no-ff = "merge --no-ff";
pl = "pull";
prune = "remote prune origin";
ps = "push";
pulls = "!gh pr list --web";
rbc = "rebase --continue";
rdup = "!git dup && git rebase develop";
remotes = "remote -v";
repush = "!git pull --rebase && git push";
ri = "rebase --interactive";
rid = "!git rebase -i $(git merge-base develop HEAD)";
rim = "!git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)";
2024-01-25 08:12:33 +00:00
rip = "!git rebase -i $(git merge-base production HEAD)";
ris = "!git rebase -i $(git merge-base staging HEAD)";
riu = "!git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})";
2024-01-25 08:12:33 +00:00
rmup = "!git mup && git master-to-main-wrapper rebase %BRANCH%";
sl = "log --oneline --decorate -20";
sla = "log --oneline --decorate --graph --all -20";
slap = "log --oneline --decorate --graph --all";
slp = "log --oneline --decorate";
2024-03-02 23:41:53 +00:00
stash = "stash --included-untracked";
2024-01-25 08:12:33 +00:00
unassume = "update-index --no-assume-unchanged";
uncommit = "reset --soft HEAD^";
unstage = "reset";
update = "!git fetch --all --jobs=4 --prune --progress && git rebase --autostash --stat";
2024-01-25 08:12:33 +00:00
upstream = "rev-parse --abbrev-ref --symbolic-full-name @{u}";
ureset = "!git reset --hard $(git upstream)";
worktrees = "worktree list";
2023-11-06 23:48:09 +00:00
};
2024-01-25 08:12:33 +00:00
2024-07-05 14:12:06 +00:00
ignores = [
"/.ddev/providers/"
"/.direnv/"
"/.ignored/"
"/.issue-id"
"/.phpactor.json"
"/notes"
"/todo"
];
2024-01-25 08:12:33 +00:00
extraConfig = {
branch = {
autosetupmerge = true;
autosetuprebase = "always";
sort = "-committerdate";
2024-01-25 08:12:33 +00:00
};
2024-07-09 13:25:00 +00:00
2024-01-25 08:12:33 +00:00
checkout.defaultRemote = "origin";
color.ui = true;
column.ui = "auto";
2024-07-09 13:25:00 +00:00
commit.template = "~/.gitmessage";
2024-01-25 08:12:33 +00:00
core = {
editor = "nvim";
excludesFile = "~/.config/git/ignore";
pager = "delta";
};
2024-07-09 13:25:00 +00:00
2024-01-25 08:12:33 +00:00
delta.line-numbers = true;
diff.tool = "vimdiff";
2024-01-25 08:12:33 +00:00
fetch.prune = true;
gpg.format = "ssh";
2024-01-25 08:12:33 +00:00
grep.lineNumber = true;
help.autocorrect = "1";
init.defaultBranch = "main";
2024-07-09 13:25:00 +00:00
maintenance = {
auto = false;
strategy = "incremental";
};
2024-07-09 13:25:00 +00:00
2024-01-25 08:12:33 +00:00
merge.ff = "only";
2024-07-09 13:25:00 +00:00
2024-01-25 08:12:33 +00:00
push = {
autoSetupRemote = true;
default = "upstream";
};
2024-07-09 13:25:00 +00:00
2024-01-25 08:12:33 +00:00
pull = {
ff = "only";
rebase = true;
};
2024-07-09 13:25:00 +00:00
2024-01-25 08:12:33 +00:00
rebase = {
autosquash = true;
autostash = true;
};
2024-07-09 13:25:00 +00:00
user.signingkey = "~/.ssh/id_rsa.pub";
2023-11-06 23:48:09 +00:00
};
2024-01-25 08:12:33 +00:00
};
2023-11-06 23:48:09 +00:00
};
home.packages = [ pkgs.git-instafix ];
home.sessionVariables = {
GIT_INSTAFIX_UPSTREAM = "origin/main";
};
2023-11-06 23:48:09 +00:00
}