git filter and accidentally pushing commit history to github

Any help, hi guys i want to delete a file and used git filter-branch so i accidently pushed all the commit history to github now how do i fix this? 

Hi @zukelwa20,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the How to use Git and GitHub board. No action is needed on your part; you can continue the conversation as normal here.

Let me know if you have any other questions or if I can help with anything else.

Cheers!

I’m not sure what exactly the problem is from your description. You say that you wanted to delete a file and used git filter-branch, I assume to delete all existence of the file from the repository. Then you pushed all commit history to GitHub. Given that description, it sounds like everything worked as intended … ? Did you delete the wrong file? Did you not delete the file? Did you push the wrong history or repository to GitHub?

Let us know.

I pushed the wrong history how can I reverse it?

There’s no easy way to “reverse” a push. Git is a version control system and for that reason errs on the side of keeping data rather than forgetting or losing it. You can, however, change the local history of a branch to whatever you want and use git push --force to force the remote GitHub repository to accept the new history of that branch.

I hope that helps!

1 Like