3

How do I revert my Github Repository on Github to it's previous state?
I had made some change and committed them to github, but now I want to undo those changes on github. How would I do that?

I tried doing git reset --hard 7727c5bfa99 but that ONLY changed the repository on my computer and not on the github website

Karlo Kokkak
  • 3,674
  • 4
  • 18
  • 33
Karliene
  • 147
  • 1
  • 3
  • 10
  • if you commit again after the reset, github will reflect your local situation. – Jorg May 20 '18 at 03:46
  • 3
    Possible duplicate of [How do you roll back (reset) a Git repository to a particular commit?](https://stackoverflow.com/questions/1616957/how-do-you-roll-back-reset-a-git-repository-to-a-particular-commit) – user3483203 May 20 '18 at 03:46
  • You need to update your remote. That answer shows how to do so, after the reset. – user3483203 May 20 '18 at 03:46

2 Answers2

6

you have to push it. git push -f origin master

bongya
  • 150
  • 4
  • A forced push can cause problems for others who might have already pulled those commits. Another option would be to create a revert commit and push that up. – Todd May 22 '18 at 03:05
0

After git reset --hard 7727c5bfa99, you just push the rolled back commit to remote repository(in this case Github repository), using git push <reponame> -f.

Kazunori Takaishi
  • 2,268
  • 1
  • 15
  • 27