Reputation: 3877
By mistake I have done git commit
of a big file in local Git Repo and pushed in remote(it got pushed as size was less than 100Mb though very large).
After that commit, I did many other commits(so lost track where I committed the large file).
On git push
I got an error that the file is > 100 Mb(as the file size had increased) so it's unable to push.
After I got the error I did git rm
on that file.
Now, when I do git push
again the same error is still coming.
My approach is to first retrieve the git rm
file(using git checkout commit#wherefilewasnotdeleted
) then remove the file from the commit(using git reset -- soft Head
) ?
I am trying the above approach still it's not getting out of the code that I push when I do git push
?
Kindly suggest what to do?
Upvotes: 0
Views: 94
Reputation: 142662
You should use this tool:
https://rtyley.github.io/bfg-repo-cleaner/
It the prefect tool for this kind of task
BFG Repo-Cleaner
an alternative to git-filter-branch.
The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:
- Removing Crazy Big Files
- Removing Passwords, Credentials & other Private data
In all these examples bfg is an alias for java -jar bfg.jar.
# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa} my-repo.git
Upvotes: 2