git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git error message suggests an invalid switch

From
RSRobert Simpson <no-reply@mailscreen.com>
Date
Apr 28, 2020, 23:12 UTC
Message-ID
<60af77100df823b4112c08e6c1b8533f.squirrel@socialwebmail.com>

The command below shows an error message that says "try -b". However "-b" is not a valid switch for the command, as indicated by "unknown swtich 'b'" when that has been added to the command.

-------------------------------------------------------------------- git switch "master" --track "origin/master"

fatal: missing branch name; try -b
git switch -b "master" --track "origin/master"

error: unknown switch `b' usage: git switch [<options>] [<branch>]

    -c, --create <branch>
                          create and switch to a new branch
    -C, --force-create <branch>
                          create/reset and switch to a branch
    --guess               second guess 'git switch <no-such-branch>'
    --discard-changes     throw away local modifications
    -q, --quiet           suppress progress reporting
    --recurse-submodules[=<checkout>]
                          control recursive updating of submodules
    --progress            force progress reporting
    -m, --merge           perform a 3-way merge with the new branch
    --conflict <style>    conflict style (merge or diff3)
    -d, --detach          detach HEAD at named commit
    -t, --track           set upstream info for new branch
    -f, --force           force checkout (throw away local modifications)
    --orphan <new-branch>
                          new unparented branch
    --overwrite-ignore    update ignored files (default)
    --ignore-other-worktrees
                          do not check if another worktree is holding the
given ref
Next: Denton Liu
Message 1 of 8 in “Git error message suggests an invalid switch”
  1. Robert SimpsonApr 28, 2020
  2. switch: fix errors and comments related to -c and -CDenton Liu, Apr 29, 2020
  3. Taylor BlauApr 29, 2020
  4. Eric SunshineApr 29, 2020
  5. Junio C HamanoApr 29, 2020
  6. switch: fix errors and comments related to -c and -CDenton Liu, Apr 30, 2020
  7. Taylor BlauApr 30, 2020
  8. Junio C HamanoApr 30, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.