From cea45c27fd56a6b93bcc5c6c90cc3430c8967988 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 11 Jul 2022 08:37:12 +0200 Subject: [PATCH] feat(git): add clone-worktree alias --- home-manager/git.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home-manager/git.nix b/home-manager/git.nix index e0446a4..ec789ca 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -31,7 +31,8 @@ }; aliases = { - identity = "! git config user.name \"$(git config user.$1.name)\"; git config user.email \"$(git config user.$1.email)\"; git config user.signingkey \"$(git config user.$1.signingkey)\"; git config commit.gpgsign \"true\"; :"; + identity = ''! git config user.name "$(git config user.$1.name)"; git config user.email "$(git config user.$1.email)"; git config user.signingkey "$(git config user.$1.signingkey)"; git config commit.gpgsign "true"; : ''; + clone-worktree = ''! mkdir $2; git clone $1 $2/.base; BRANCH=`git -C $2/.base symbolic-ref --short HEAD`; echo "branch is $BRANCH"; git -C $2/.base checkout --detach HEAD; git -C $2/.base worktree add ../$BRANCH; :''; }; ignores = [