From 0aa72cf6a2a3ec255adc948d75e1f0f7270d5955 Mon Sep 17 00:00:00 2001 From: Sandyandi dela Cruz Date: Thu, 17 Jul 2025 18:18:33 +0800 Subject: [PATCH] Allow automatic association to an existing branch or creation of new branch with `gwta` when 2nd positional parameter (`branch`) is omitted. --- aliases/git/git-aliases.nu | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aliases/git/git-aliases.nu b/aliases/git/git-aliases.nu index 488d57f98..caec4e791 100644 --- a/aliases/git/git-aliases.nu +++ b/aliases/git/git-aliases.nu @@ -225,8 +225,12 @@ export alias gupav = git pull --rebase --autostash --verbose export alias gwch = git whatchanged -p --abbrev-commit --pretty=medium export alias gwt = git worktree -export def gwta [path: path, branch: string] { - git worktree add $path $branch +export def gwta [path: path, branch?: string] { + if $branch != null { + git worktree add $path $branch + } else { + git worktree add $path + } } export alias gwtls = git worktree list export alias gwtmv = git worktree move @@ -239,3 +243,4 @@ export alias gamc = git am --continue export alias gams = git am --skip export alias gama = git am --abort export alias gamscp = git am --show-current-patch +