-1

Possible Duplicate:
Rolling back a remote Git repository

I have created a project in PHP and I pushed it to GitHub. However I never pulled anything, because I work alone so I don't think that should cause any conflict, because I am always updated with my Github repository. Today I did a lot of changes in various files and I pushed it to Github repository, now I want to discard them all, instead of pushing them again, is there anything that I can get back to my previous revision by using any GitHub command?

Cœur
  • 37,241
  • 25
  • 195
  • 267
ScoRpion
  • 11,364
  • 24
  • 66
  • 89
  • What does SVN have to do with this? – Matt Dec 09 '11 at 13:38
  • i want to pull or say i want to get my precious revision, is there anyway to load my previous revision – ScoRpion Dec 09 '11 at 13:42
  • I am Sorry to ask the question this way, It was my first time to use Subversion, and after going through tutorial i realized this is a poor question, i have requested to close it, or if possible Delete it – ScoRpion Dec 10 '11 at 06:05

2 Answers2

0

Git is not GitHub. They are two different things. You need a git command (or commands), not a "GitHub command", which doesn't exist and doesn't make sense.

Use git reset --hard HEAD~ to reset your branch to its previous commit, and git push -f to push your revised branch to GitHub.

user229044
  • 232,980
  • 40
  • 330
  • 338
0

Using git reset --hard HEAD~ will get you back to your previous revision.

As the other answer says, Git is not GitHub. GitHub is a remote repo to hold your data so that you can collaborate with others or work with the project from different machines.

The best way to undo changes that you have pushed to GitHub would be to do git revert HEAD this will create a new commit that undoes the changes in HEAD. Then you can push that to GitHub. This is a better habit to get into for undoing changes. If/when you have others working on the same project changing and pushing the history using reset will lead to problems.

Schleis
  • 41,516
  • 7
  • 68
  • 87