Reputation: 88
I was working on a project and realized that my current approach isn't working (Number 2 on the picture). So I went back to an old commit (Number 1) and started working.
Git/Sourcetree apparently created a new branch for the new commits I produced up to number 3. I switched back to another branch to test something but when I wanted to go back to the branch with number 3 at the end the branch wasn't there anymore.
Is there a way to get this "local temporary" branch back?
Thank you for your help!!
Upvotes: 0
Views: 77
Reputation: 88
It seems like I was on detached HEAD when you run git checkout commit1
. You could run git reflog
to find the old commit and then use git checkout -b <branchname> <commit>
to create a real branch from that commit.
Upvotes: 1