Add Git configuration management via nix
- Create modules/git.nix with user info and useful settings - Configure git to use SSH (disable credential helper) - Add comprehensive git aliases and sensible defaults - Import git module in flake.nix homeConfiguration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b50b44bd2f
commit
4f4e566c06
2 changed files with 73 additions and 0 deletions
|
|
@ -44,6 +44,7 @@
|
||||||
./modules/tmux.nix
|
./modules/tmux.nix
|
||||||
./modules/zsh.nix
|
./modules/zsh.nix
|
||||||
./modules/ssh.nix
|
./modules/ssh.nix
|
||||||
|
./modules/git.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.username = "yanlin";
|
home.username = "yanlin";
|
||||||
|
|
|
||||||
72
modules/git.nix
Normal file
72
modules/git.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
userName = "Yan Lin";
|
||||||
|
userEmail = "github@yanlincs.com";
|
||||||
|
|
||||||
|
extraConfig = {
|
||||||
|
credential.helper = "";
|
||||||
|
|
||||||
|
core = {
|
||||||
|
editor = "nvim";
|
||||||
|
autocrlf = "input";
|
||||||
|
ignorecase = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
init.defaultBranch = "main";
|
||||||
|
|
||||||
|
push = {
|
||||||
|
default = "simple";
|
||||||
|
autoSetupRemote = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
pull = {
|
||||||
|
rebase = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
merge = {
|
||||||
|
conflictstyle = "diff3";
|
||||||
|
};
|
||||||
|
|
||||||
|
diff = {
|
||||||
|
colorMoved = "default";
|
||||||
|
};
|
||||||
|
|
||||||
|
status = {
|
||||||
|
showUntrackedFiles = "all";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases = {
|
||||||
|
st = "status";
|
||||||
|
co = "checkout";
|
||||||
|
br = "branch";
|
||||||
|
ci = "commit";
|
||||||
|
unstage = "reset HEAD --";
|
||||||
|
last = "log -1 HEAD";
|
||||||
|
visual = "!gitk";
|
||||||
|
|
||||||
|
# Better logging
|
||||||
|
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||||
|
lga = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all";
|
||||||
|
|
||||||
|
# Quick operations
|
||||||
|
up = "pull --rebase";
|
||||||
|
cm = "commit -m";
|
||||||
|
ca = "commit --amend";
|
||||||
|
|
||||||
|
# Show changes
|
||||||
|
d = "diff";
|
||||||
|
dc = "diff --cached";
|
||||||
|
ds = "diff --stat";
|
||||||
|
|
||||||
|
# Stash operations
|
||||||
|
sl = "stash list";
|
||||||
|
sp = "stash pop";
|
||||||
|
ss = "stash save";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue