I somehow have been committing all changes with Xcode somewhere not on any branch if I understand the message (in the title) correctly. I do not remember how and when it happened, probably when I was trying to checkout a version from the master while being on a branch.
Now, in the source control navigator in Xcode, if I click one of the branches or the master, I only see very old commits. I get to see recent commits only if I click the project/app name at the very top in the source control navigator in Xcode.
Also, if I checkout a recent version (within last 3 months), all the later ones get lost (I do not see them anywhere anymore). And if I try to cherry pick code Xcode tells me that the working copy is currently not on a branch.
Another strange thing is git status says "HEAD detached from 0c3e248" (marked with 3 in a white circle in the screenshot below). This point is only about a week ago and still doesn't seem to be on any branch, while the latest "proper" commit was on "reserve" branch (marked with 5 in a white circle in the screenshot).
I want to get everything back to normal. if that is not possible, I want to be able
- to go back to an earlier version (marked with 2 in the screenshot) without losing later ones
- to cherry pick the code
Tried searching the internet for this issue but wasn't very lucky. Please, help
Am not an expert in git, so please, bear with me if I didn't explain it right and tell me what to do at a beginner level.
below are screenshots of the git tree produced by "git log --graph --all --oneline" with the following marks:
- -- the latest commit (not on any branch)
- -- the commit I want to get back to (or to the one right before it, they are not on any branch either)
- -- the commit for which git status returns "HEAD detached from" (not on any branch)
- -- last commit on master branch
- -- latest commit on any branch at all