7

I messed up and actually push a git repo to the url of another one of my repos. I am trying to undo this but am having trouble and I haven't used 'git reset' before.

Say the hash of the last good commit was 12345. I tried doing git reset --hard 12345 which seemed to succeed without error but for some reason it did not change my local files. My local working directory still contains all of the files that were accidentally pushed. How do I revert them?

PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
  • 1
    Let me understand, you want to revert a push? Are you in the repository that pushed or the one that you pushed to? – michelpm Jul 02 '12 at 21:49
  • Does `git status` show some files as being modified? (What makes you think that Git didn't restore the files?) – Richard Hansen Jul 03 '12 at 03:45
  • Only push affects another repo. Is that your problem here, that doing the reset in one repo didn't affect the other? If so, whichever repo you did the reset in, do the same in the other. – jthill Nov 14 '14 at 00:40

1 Answers1

11

Are these untracked files? You can remove these by doing:

git clean -f -d

triad
  • 20,407
  • 13
  • 45
  • 50