In Git, if a branch does not exist and you need to create and switch to it in one command, use:
git checkout -b
OR
git switch -c
(For newer Git versions, switch is preferred.)
git checkout -b staging
-b creates a new branch.
staging is the new branch name.
This also switches to the new branch immediately.
Why the other options are incorrect?
A. git branch -m st → Incorrect, -m is used for renaming a branch, not creating one.
B. git commit -m staging → Incorrect, commit -m is used to commit changes with a message, not to create a branch.
C. git status -b staging → Incorrect, git status shows the current repository state, but -b is not a valid option for it.
Submit