I tried something like this:
git branch temp
to create a new branch but don't move the HEAD
. But I get:
# Not currently on any branch.
I don't want to merge anything, I just want a new branch at the current HEAD
.
I tried something like this:
git branch temp
to create a new branch but don't move the HEAD
. But I get:
# Not currently on any branch.
I don't want to merge anything, I just want a new branch at the current HEAD
.
You're sitting on a detached HEAD
:
git checkout <sha>
You want to make a branch at that commit:
git branch my-new-branch
And now switch to that branch:
git checkout my-new-branch
branch
to not only make the branch, but switch to it too. I wanted to make clear the difference between branch
and checkout
. –
Obnoxious You can also use:
git switch -c <new branch name>
© 2022 - 2024 — McMap. All rights reserved.
git checkout -b my-new-branch
. – Sensitize