I did a
git reset <sha>
back to quite an old sha in my repository and I wanted to go back to the old head. How do I do that? If I do a
git pull
would that do it?
Also, there are a lot of unstaged files in my repository now.
I did a
git reset <sha>
back to quite an old sha in my repository and I wanted to go back to the old head. How do I do that? If I do a
git pull
would that do it?
Also, there are a lot of unstaged files in my repository now.
The problem is when you reset a state back to an older state you lost your history. So you don't see newer commits. What you can do is to pull again what you said. Then you pull all newer changes from your remote repository.
Other solution is to use the reflog to restore unlinked commits.
https://www.atlassian.com/git/tutorials/rewriting-history/git-reflog
Example from the Atlassian page:
#git reflog
0a2e358 HEAD@{0}: reset: moving to HEAD~2
0254ea7 HEAD@{1}: checkout: moving from 2.2 to master
c10f740 HEAD@{2}: checkout: moving from master to 2.2
Then you can search an entry and restore it.
#git reset --hard 0254ea7