search

Home  >  Q&A  >  body text

github - How to delete all .swo files using git

When using vim, sometimes it will exit abnormally and .swp files will be generated in the folder. Can git delete such files by default?

伊谢尔伦伊谢尔伦2825 days ago854

reply all(3)I'll reply

  • 为情所困

    为情所困2017-05-02 09:37:14

    What is "git deleted by default"? Can I understand it this way:

    1. You don’t want to submit.swo文件?那应该在.gitignore里增加过滤。譬如:.swo

    2. You don’t want to affect future modifications to files that were exited abnormally last time? There is no good way, just delete it manually

    reply
    0
  • 某草草

    某草草2017-05-02 09:37:14

    Delete files: rm -rf *.swp
    Delete git records: git rm *.swp

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:37:14

    Find the file and remove it from the git repository, but it will not be removed locally:
    find ./ -name ".*.swp" -exec git rm --cache {} ;

    Then filter the *.swp追加到.gitignore file

    reply
    0
  • Cancelreply