git - Recover detached head commit -


this question has answer here:

suppose following scenario.

  1. create branch in local git repository on master branch.

  2. checkout new branch , commits.

  3. checkout master branch again.

  4. delete newly created branch.

now, there way go last commit made in newly created branch if not remember commit id of it?

you can a:

git checkout head@{1} 

or if use recent version of git:

git checkout - 

Popular posts from this blog