I have a commit to which I accidentally added a file that should not have been. In the current commit is not scary, let it be. But how to make him get out of the next one?

  • one
    git rm <имя файла> and commit. But you can fix the old commit - KoVadim
  • one
    will remove of course. - KoVadim
  • 2
    If the file does not change, it will not fall into the commit. Most likely you accidentally committed a file and don't want git to know about it, right? - KoVadim
  • one
  • one
    Then either do as suggested by @alexanderbarakin, but in this case, one version of the file will remain in the repository and you can “pull out” it if necessary. If you need to clean out the repository, then so - help.github.com/articles/remove-sensitive-data - KoVadim

1 answer 1

git rm --cached foobar.txt will remove the file from Git, but leave it on disk.