Reputation: 33953
I have spend half an hour reading questions and answers and still I didn't find a simple way to do this. So, is there an easy way to remove unwanted file from Github history (just to name the file and delete it)?
Upvotes: 0
Views: 1024
Reputation: 25304
As @VonC says, GitHub doesn't provide the ability to remove files from history through their UI. As an outsider, this would be my view on why that's so:
git filter-branch
, which is very slow on big repos - GitHub would have had to chuck these clean-up jobs on to a long-running queue, and tell you to come back later. In the case of a big repo, it could have taken days to complete the job.Given all that, it's quite reasonable that GitHub don't support it themselves. You are expected to do it yourself from the command-line- but it's not that hard, I wrote the BFG to make this process simple:
bfg --delete-files myBad.mp3
...the BFG is now recommended by GitHub, Atlassian, and also in the docs for git filter-branch itself.
Incidentally, Git is the underlying source-control software, GitHub is a company that provides hosted-Git (so you're rewriting Git history, rather than GitHub history really).
Full disclosure: I'm the author of the BFG Repo-Cleaner.
Upvotes: 3
Reputation: 1323303
Not from GitHub directly.
You would still have to clone it locally, clean it (with BFG for instance, faster than the git filter-branch
), and push it back.
The push would be a force one git push --force, which means you need to notify other users of that repo, for them to reset their own clone.
For instance (with bfg: "Cleaning Up Git Repositories With The BFG Repo-Cleaner"):
bfg --delete-files id_{dsa,rsa} my-repo.git
Upvotes: 1