Skip to content

Commit ba9a4c1

Browse files
authored
Enhance gwta (#1143)
Allow automatic association to an existing branch or creation of new branch with `gwta` when 2nd positional parameter (`branch`) is omitted.
1 parent b09b60c commit ba9a4c1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

aliases/git/git-aliases.nu

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,12 @@ export alias gupav = git pull --rebase --autostash --verbose
225225
export alias gwch = git whatchanged -p --abbrev-commit --pretty=medium
226226

227227
export alias gwt = git worktree
228-
export def gwta [path: path, branch: string] {
229-
git worktree add $path $branch
228+
export def gwta [path: path, branch?: string] {
229+
if $branch != null {
230+
git worktree add $path $branch
231+
} else {
232+
git worktree add $path
233+
}
230234
}
231235
export alias gwtls = git worktree list
232236
export alias gwtmv = git worktree move
@@ -239,3 +243,4 @@ export alias gamc = git am --continue
239243
export alias gams = git am --skip
240244
export alias gama = git am --abort
241245
export alias gamscp = git am --show-current-patch
246+

0 commit comments

Comments
 (0)