2

I want to go back to a certain commit (not just one file; the whole project). I tried: git checkout 0780033 but then I got the following message:

You are in "detached head" state. You can look around...

And then I am not in actual Branch --> but in branch ((0780033...). I want to "copy" the project at this commit (0780033), to be the newest version.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
lars111
  • 1,233
  • 4
  • 12
  • 21
  • 3
    Possible duplicate of [Revert Git repo to a previous commit](http://stackoverflow.com/questions/4114095/revert-git-repo-to-a-previous-commit) – Ferrybig Jan 22 '16 at 17:33

2 Answers2

2

When you checkout to a specific commit, you change to detached head state that means that you aren't in your branch anymore.

You can create a new branch from your specific commit as @Mureinik explained with:

$ git checkout -b my_new_branch

And come back to your branch with:

$ git checkout previous_branch

If you want to know more about detached state, I'd suggest you to read the following links:

miguelbgouveia
  • 2,963
  • 6
  • 29
  • 48
0

You could check out this commit to a new branch and work from there:

$ git checkout -b my_new_branch
Mureinik
  • 297,002
  • 52
  • 306
  • 350