I tried to create new branch from a certain commit of master. I don't remember the command I used but I think this one (but not sure)
git branch branchname <sha1-of-commit>
So, Commit 4, 7, 8, 10 and 13 are on the new branch and you want them to be in master instead.
You can't move into a detached HEAD state, with that command above, you will you will have to do
git checkout <sha-1 of commit>
git checkout branchname
So its most likely you ran another commit that has messed things, use
to try and find out where things went wrong.
However, if you ran the right command, and you can't remember. To merge that branch back into master.
1/ Do a checkout to commit 13, I am assuming that's the final commit you made on the detached HEAD state.
git checkout <sha-1 of commit 13>
2/ Give that branch a name, this means give this branch a name, that makes checkout to it later easier.If you do run
git branch -a
You'll get something like this
(detached from <sha-1 of commit 13) master *Other branches
To rename the branch do;
git checkout -b <branch-name>
Then list the branches again
<branch-name> master *Other branches
3/ Merging is easy now, simply checkout to your master branch and merge
git checkout master git merge <branch-name>