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?

3
  • 1
    Let me understand, you want to revert a push? Are you in the repository that pushed or the one that you pushed to? Commented Jul 2, 2012 at 21:49
  • Does git status show some files as being modified? (What makes you think that Git didn't restore the files?) Commented Jul 3, 2012 at 3: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. Commented Nov 14, 2014 at 0:40

1 Answer 1

12

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

git clean -f -d

Sign up to request clarification or add additional context in comments.

1 Comment

no it's all of the files that were pushed to the repo by accident. And none of the files I want are restored.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.