Git new branch is not a branch when using a previous commit
I was on a branch in Git, doing some work. Then I decided to check out one of my previous commits on that branch using the commit’s hash, with
git checkout -b new_branch 6e559cb. Now when I enter “git branch” it says that I’m currently on “(no branch)”. How do I merge this no-branch into the branch it was split from? Thanks!
2 Solutions collect form web for “Git new branch is not a branch when using a previous commit”
If somehow your command didn’t create a branch at 6e559cb, you simply can create one now (where you are currently in “no branch”, that is “detached HEAD” mode.
git branch new_branch git checkout new_branch # or git checkout -b new_branch
I am not sure that you did it in proper way (I am assuming that you are working on “new_branch” and you wanted to apply commit from another branch on top of that).
The most convenient way would be do cherry-pick (or merge) commit from one branch to another.
git[new_branch]$ git cherry-pick 6e559cb