The latest commit gone after hard reset

I commited my changes and didn’t push them to the server. Then I did hard reset to one of my previous commits and my latest commit gone. Does it mean commits which weren’t pushed to server gone after hard reset?

Is it possible to recover my latest commit?

  • How to get a list of Ostream or Oinfo in a variable from a repository path in gitpython?
  • Can't clone a github repo on Linux via HTTPS
  • What's the bzr equivalent to git clone --depth HEAD
  • Git: How to overwrite local change?
  • Git - diff3 Conflict Style - Temporary merge branch
  • Git archive of repository with uncommitted changes
  • How to get a list of pull requests between 2 commits
  • Get default remote push and default remote branch
  • How to git svn fetch + rebase in one operation?
  • Git push URL encoding issue
  • A good strategy to fix unwanted commits and wrong merges in Git
  • How can I make a complex octopus merge?
  • One Solution collect form web for “The latest commit gone after hard reset”

    Yes, but not immediately.
    Reflog entries will expire in time and the contents will disappear on garbage collection.

    You can still get them back from the reflog:

    git reflog

    and reset to them/checkout:

    git reset HEAD@{1}

    or, e.g. checking it out to a rescue branch:

    git checkout -b rescue HEAD@{1}
    Git Baby is a git and github fan, let's start git clone.