As I recently tried to push my commits to github, I got the same error message as in this question. I removed the files from my repository but now have to clean up the history. As advised in the answers I looked into BFG, which seems to be the solution. While reading through the instructions it starts with using git --mirror link-to-remote-repo
.
Now I am wondering, because I couldn't push the newest commit yet and probably my local commit history is longer than the one on github. Furthermore I am unsure as all the work I did is on a branch and not on master and how it affects my repository.
Manual solution (based on cheery pick
)
EDIT: Before you start please commit or stash your local changes.
Let's say we have two branches master
and dev
which have common commit with SHA1 = X. Branch dev
contains commits A1, A2, ..., A16
git checkout dev
git checkout -b new-dev
git reset --hard X
For each commit in dev
(A1, ..., A16):
git cherry-pick A1 --no-commit
git status
git reset HEAD myfolder/mybinary.rpm
git rm myfolder/mybinary.rpm