I left my main branch to checkout a specific commit and forgot to go back, resulting in my subsequent commits as being part of that checked-out commit rather than the main branch. Shown in git reflog
f0420e4 HEAD@{1}: commit: :brain: `redesign` attributes as single number -> Attribute object encapsulating .base .modifier
cb4a198 HEAD@{2}: commit: :brain: `redesign` Item Rarity type: string literals -> enum
1d61b75 HEAD@{3}: checkout: moving from main to 1d61b75
70c9cf5 (HEAD -> main, origin/main) HEAD@{4}: reset: moving to 70c9cf5ab06b1838b1b7c4b8278728bedbaecbf5
in main, I don’t see the most recent two redesign commits – they seem to be only existing on the 1d61b75 commit. How can I move them to be on the main branch, without having a merge register in my git history?
>Solution :
Go back to main and do a cherry-pick for the commits you need:
$ git checkout main
$ git cherry-pick cb4a198 f0420e4
Naturally, there can be conflicts, but if so, just fix them and do git cherry-pick --continue.