diff --git a/docs/nu-git-manager-sugar/git/gm-repo-bisect.md b/docs/nu-git-manager-sugar/git/gm-repo-bisect.md index fe40495..44f4f88 100644 --- a/docs/nu-git-manager-sugar/git/gm-repo-bisect.md +++ b/docs/nu-git-manager-sugar/git/gm-repo-bisect.md @@ -1,4 +1,4 @@ -# `gm repo bisect` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L435)) +# `gm repo bisect` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L440)) bisect a worktree by running a piece of code repeatedly # Examples diff --git a/docs/nu-git-manager-sugar/git/gm-repo-branch-fetch.md b/docs/nu-git-manager-sugar/git/gm-repo-branch-fetch.md index 8fb924f..21b2044 100644 --- a/docs/nu-git-manager-sugar/git/gm-repo-branch-fetch.md +++ b/docs/nu-git-manager-sugar/git/gm-repo-branch-fetch.md @@ -6,7 +6,8 @@ fetch a remote branch locally, without pulling down the whole remote ## Parameters - `remote` <`string@get-remotes`>: the branch to fetch - `branch` <`string@get-branches`>: the remote to fetch the branch from -- `--strategy` <`string@get-strategies`> = `none`: the merge strategy to use +- `--strategy` <`string@get-strategies`>: the merge strategy to use, defaults to the `pull.rebase` Git +config option ## Signatures diff --git a/docs/nu-git-manager-sugar/git/gm-repo-branch-interactive-delete.md b/docs/nu-git-manager-sugar/git/gm-repo-branch-interactive-delete.md index be3a5a9..e5ee876 100644 --- a/docs/nu-git-manager-sugar/git/gm-repo-branch-interactive-delete.md +++ b/docs/nu-git-manager-sugar/git/gm-repo-branch-interactive-delete.md @@ -1,4 +1,4 @@ -# `gm repo branch interactive-delete` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L281)) +# `gm repo branch interactive-delete` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L286)) remove a branch interactively diff --git a/docs/nu-git-manager-sugar/git/gm-repo-ls.md b/docs/nu-git-manager-sugar/git/gm-repo-ls.md index 8d27410..c231c23 100644 --- a/docs/nu-git-manager-sugar/git/gm-repo-ls.md +++ b/docs/nu-git-manager-sugar/git/gm-repo-ls.md @@ -1,4 +1,4 @@ -# `gm repo ls` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L325)) +# `gm repo ls` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L330)) get some information about a repo diff --git a/docs/nu-git-manager-sugar/git/gm-repo-query.md b/docs/nu-git-manager-sugar/git/gm-repo-query.md index f071d66..ec64aea 100644 --- a/docs/nu-git-manager-sugar/git/gm-repo-query.md +++ b/docs/nu-git-manager-sugar/git/gm-repo-query.md @@ -1,4 +1,4 @@ -# `gm repo query` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L375)) +# `gm repo query` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L380)) queries the `.git/` directory as a database with `nu_plugin_git_query` ## Examples diff --git a/docs/nu-git-manager-sugar/git/gm-repo-switch.md b/docs/nu-git-manager-sugar/git/gm-repo-switch.md index d3d010e..5881af7 100644 --- a/docs/nu-git-manager-sugar/git/gm-repo-switch.md +++ b/docs/nu-git-manager-sugar/git/gm-repo-switch.md @@ -1,4 +1,4 @@ -# `gm repo switch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L301)) +# `gm repo switch` from `nu-git-manager-sugar git` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu#L306)) switch between branches interactively diff --git a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu index 98da6f4..04c8944 100644 --- a/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu +++ b/pkgs/nu-git-manager-sugar/nu-git-manager-sugar/git/mod.nu @@ -229,8 +229,13 @@ export def "gm repo remote add" [name: string, remote: string, --ssh]: nothing - export def "gm repo branch fetch" [ remote: string@get-remotes, # the branch to fetch branch: string@get-branches, # the remote to fetch the branch from - --strategy: string@get-strategies = "none" # the merge strategy to use + --strategy: string@get-strategies # the merge strategy to use, defaults to the `pull.rebase` Git + # config option ]: nothing -> nothing { + let strategy = $strategy | default ( + if (^git config pull.rebase) == "true" { "rebase" } else { "merge" } + ) + ^git fetch $remote $branch if (^git branch --list | lines | str substring 2.. | where $it == $branch | is-empty) { diff --git a/pkgs/nu-git-manager-sugar/tests/git.nu b/pkgs/nu-git-manager-sugar/tests/git.nu index 1e98c37..9057dfe 100644 --- a/pkgs/nu-git-manager-sugar/tests/git.nu +++ b/pkgs/nu-git-manager-sugar/tests/git.nu @@ -146,7 +146,7 @@ export def branch-fetch [] { do { cd $bar - gm repo branch fetch $"file://($foo)" foo + gm repo branch fetch $"file://($foo)" foo --strategy none assert simple-git-tree-equal [ "(foo) c2", @@ -159,7 +159,7 @@ export def branch-fetch [] { do { cd $bar - gm repo branch fetch $"file://($foo)" foo + gm repo branch fetch $"file://($foo)" foo --strategy none assert simple-git-tree-equal [ "(foo) c4", @@ -176,7 +176,7 @@ export def branch-fetch [] { do { cd $bar - gm repo branch fetch $"file://($foo)" foo + gm repo branch fetch $"file://($foo)" foo --strategy none assert simple-git-tree-equal --extra-revs ["FETCH_HEAD"] [ "c6",