0

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

Farseer
  • 4,036
  • 3
  • 42
  • 61

1 Answers1

1

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

Community
  • 1
  • 1
bredikhin
  • 8,875
  • 3
  • 40
  • 44