0

I want to remove a file from my GitHub history. It was pushed and committed many times. I'm using the next filter-branch command:

git filter-branch --index-filter 'git rm --cached "app/src/main/java/com/corecz/gitfilter/ui/TypingTestActivity.java"' HEAD

It says:

fatal: pathspec 'app/src/main/java/com/corecz/gitfilter/ui/TypingTestActivity.java' did not match any files

Do I specify the path wrong? I have it both in my local and remote repositories. I'm executing this command from the top level of my project (it doesn't allow me to do otherwise).

Corec
  • 91
  • 2
  • 9
  • 2
    You likely need `—ignore-unmatched` the error is because that file does not exist in every commit – AD7six Nov 27 '21 at 20:38
  • 1
    This does a lot more than the question asked, however I couldn’t find a better duplicate: Does this answer your question? [New repo with copied history of only currently tracked files](https://stackoverflow.com/questions/17901588/new-repo-with-copied-history-of-only-currently-tracked-files) – AD7six Nov 27 '21 at 20:43
  • @AD7six thank you, ```--ignore-unmatch``` helped! I thought what this option does is ignore if this file doesn't exist. I used it in the previous tries with different path writings but had no success (no effect at all). Now it works. – Corec Nov 28 '21 at 12:46

0 Answers0