Reputation: 4172
I created file example.txt and committed it.
After that i removed file with git rm example.txt. and committed changes
Then i used git checkout HEAD^
which in my understanding. moving me to previous commit.
The file is back now and
Now when i use git status
i get following:
# Not currently on any branch.
nothing to commit (working directory clean)
So i have two questions: 1. why right now i am not on any branch? 2. How i can return to 1 commit forward( where i removed file and committed changes). Many thanks for help
Upvotes: 0
Views: 144
Reputation: 9025
Why right now i am not on any branch?
Since you checked out a specific commit, you are in a detached state now.
How i can return to 1 commit forward( where i removed file and committed changes).
In your particular case it should be as simple as git checkout HEAD
Upvotes: 1