Why might these files be mentioned by Git when they don't exist, and how can I resolve this?
They might not exist in your current commit / worktree, but they exist somewhere in your history. You can do git log -- android/java_pid60072.hprof
to display the commits touching that file.
If you use it correctly, you can indeed use git filter-branch
to remove this file from your history, but as you didn't supply the whole command you used it is impossible to say why it didn't work. Or if the command you supplied is the complete command, then it explains that it didn't work as it is not correct for your use-case.
Alternatively, if the git log
just displays few commits that touches the file, for example because you just once added it accidentally and then didn't touch it anymore, you can also use the much simpler git rebase --interactive
to remove the file from your history.
Let's assume the git log
above shows that commit 5981c6312c65dae928f2f34311202cd93b9000d8
added the file and is the only commit touching the file, then you could simply do git rebase --interactive 5981c6312c65dae928f2f34311202cd93b9000d8~
, then modify the todo-list that opens by adding after the pick 5981c63
line a line reading
exec git rm android/java_pid60072.hprof && git commit --amend -C HEAD
Then save and close the todo-list and after the rebase is finished, your history should be cleaned and you should be able to push.