From cd4389a40f75ace28eb77d248731547782e1edb0 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Tue, 11 Nov 2025 10:59:04 +0800 Subject: [PATCH] fix: programs.git - renamed options --- home/base/core/git.nix | 100 +++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/home/base/core/git.nix b/home/base/core/git.nix index 90ea60bb..4a3be479 100644 --- a/home/base/core/git.nix +++ b/home/base/core/git.nix @@ -40,18 +40,27 @@ enable = true; lfs.enable = true; - userName = myvars.userfullname; - userEmail = myvars.useremail; + # signing = { + # key = "xxx"; + # signByDefault = true; + # }; includes = [ { - # use different email & name for work + # use different email & name for work: + # + # [user] + # email = "xxx@xxx.com" + # name = "Ryan Yin" path = "~/work/.gitconfig"; condition = "gitdir:~/work/"; } ]; - extraConfig = { + settings = { + user.email = myvars.useremail; + user.name = myvars.userfullname; + init.defaultBranch = "main"; trim.bases = "develop,master,main"; # for git-trim push.autoSetupRemote = true; @@ -63,58 +72,51 @@ "ssh://git@github.com/ryan4yin" = { insteadOf = "https://github.com/ryan4yin"; }; - # "ssh://git@gitlab.com/" = { - # insteadOf = "https://gitlab.com/"; - # }; - # "ssh://git@bitbucket.com/" = { - # insteadOf = "https://bitbucket.com/"; + # "ssh://git@bitbucket.com/ryan4yin" = { + # insteadOf = "https://bitbucket.com/ryan4yin"; # }; }; - }; - # signing = { - # key = "xxx"; - # signByDefault = true; - # }; + aliases = { + # common aliases + br = "branch"; + co = "checkout"; + st = "status"; + ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate"; + ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat"; + cm = "commit -m"; # commit via `git cm ` + ca = "commit -am"; # commit all changes via `git ca ` + dc = "diff --cached"; - # A syntax-highlighting pager for git, diff, grep, and blame output - delta = { - enable = true; - options = { - diff-so-fancy = true; - line-numbers = true; - true-color = "always"; - # features => named groups of settings, used to keep related settings organized - # features = ""; + amend = "commit --amend -m"; # amend commit message via `git amend ` + unstage = "reset HEAD --"; # unstage file via `git unstage ` + merged = "branch --merged"; # list merged(into HEAD) branches via `git merged` + unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged` + nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist` + + # delete merged branches except master & dev & staging + # `!` indicates it's a shell script, not a git subcommand + delmerged = ''! git branch --merged | egrep -v "(^\*|main|master|dev|staging)" | xargs git branch -d''; + # delete non-exist(remote) branches + delnonexist = "remote prune origin"; + + # aliases for submodule + update = "submodule update --init --recursive"; + foreach = "submodule foreach"; }; }; + }; - aliases = { - # common aliases - br = "branch"; - co = "checkout"; - st = "status"; - ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate"; - ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat"; - cm = "commit -m"; # commit via `git cm ` - ca = "commit -am"; # commit all changes via `git ca ` - dc = "diff --cached"; - - amend = "commit --amend -m"; # amend commit message via `git amend ` - unstage = "reset HEAD --"; # unstage file via `git unstage ` - merged = "branch --merged"; # list merged(into HEAD) branches via `git merged` - unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged` - nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist` - - # delete merged branches except master & dev & staging - # `!` indicates it's a shell script, not a git subcommand - delmerged = ''! git branch --merged | egrep -v "(^\*|main|master|dev|staging)" | xargs git branch -d''; - # delete non-exist(remote) branches - delnonexist = "remote prune origin"; - - # aliases for submodule - update = "submodule update --init --recursive"; - foreach = "submodule foreach"; + # A syntax-highlighting pager for git, diff, grep, and blame output + programs.delta = { + enable = true; + enableGitIntegration = true; + options = { + diff-so-fancy = true; + line-numbers = true; + true-color = "always"; + # features => named groups of settings, used to keep related settings organized + # features = ""; }; };