Which command keeps these two new commits safely on a branch?
$ git checkout v1.2 You are in 'detached HEAD' state. $ git commit -am "fix" $ git commit -am "tests"
git switch -c fix-v1.2git reset --hard v1.2git restore --source v1.2git switch main
Creating a branch at the current detached commit gives the new commits a name. Switching away first would leave them reachable only through the reflog.
Play Git ▸