search

Home  >  Q&A  >  body text

git question: About gitignore

I have a question about git:

I forgot to add .gitignore before committing, and committed some binary files in the format of .db or .pyc. And to make matters worse, I committed several versions without paying attention. Now how do I commit it? Are these binaries being removed in batches from all versions and will they be stopped from being tracked in the future? Thank you!

我想大声告诉你我想大声告诉你2770 days ago606

reply all(3)I'll reply

  • 迷茫

    迷茫2017-05-02 09:35:23

    To rewrite past commits, you can use git filter-branch or this

    reply
    0
  • 高洛峰

    高洛峰2017-05-02 09:35:23

    Use git rm file to delete the tracking of the file, and it will be deleted locally.
    Use git rm file --cached file to delete the tracking of the file, but it will be retained locally.

    Remember to add modification .gitignore and then push it

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-02 09:35:23

    Please ensure safety before starting the command:

    git rm --cached [文件名]

    reply
    0
  • Cancelreply