I am a newbie with git. I have commited some changes. I made a mistake and I didn't commit it in any branch and it is in head. I would like to commit this in a branch.
If I run git reflog show I can see that it is in head(7) with a code 15a3e43
If I run this, then I'm in the last element of head git chechout HEAD^
if I run git chechout -b branchA branchA is created and the last is moved to this branch
I have tried to get to head(7) git checkout HEAD@{1} git chechout 15a3e43 and no way. I would like to move the commit of head(7) to a branch.
Thanks, Joan
If you want to add a specific commit to another branch, you can use cherry-pick:
git cherry-pick <commit_hash>
A new commit with the content of
<commit_hash>
will be created.