We have updated our Terms of Service, Code of Conduct, and Addendum.

Restoring git commit after reverting from remote repo

Options
Johan Woger
Johan Woger Posts: 16

I was a bit careless and i pointed my stream deployment to a remote repo
that had a bunch of old commits. Now my leader pulled down those old
changes and they were deployed to my worker nodes. I reverted back from
the remote repo but still have no access to my old commits which should
still be living on the leaders local git. How do i fix this?

Tagged:

Best Answer

  • Kyle McCririe
    Kyle McCririe Posts: 29 ✭✭
    Answer ✓
    Options

    Hello you should be able to use the “git reset --hard” command to reset the changes back to the last known good commit.

    To identify the last known good commit, you can use “git reflog”.

    Then you can reset to that commit with “git reset --hard <hash of last good commit>”.

Answers

  • Kyle McCririe
    Kyle McCririe Posts: 29 ✭✭
    Answer ✓
    Options

    Hello you should be able to use the “git reset --hard” command to reset the changes back to the last known good commit.

    To identify the last known good commit, you can use “git reflog”.

    Then you can reset to that commit with “git reset --hard <hash of last good commit>”.