如何永久删除'〜'文件? [英] How to remove the '~' files forever?

查看:89
本文介绍了如何永久删除'〜'文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我签出一个分支时,都会发生这种情况:

  M src / note / views.py〜
D src / static / assets / css / inside.css〜
D src / templates / index.html〜
D src / templates / note / create.html〜
D src / templates / note / list.html〜
D src / templates / note / unite.html〜

这令人非常恼火,让我感到恶心。如何永久删除这些文件?

解决方案

您可能希望忽略它们(这些是由编辑器编写的备份文件)。 .gitignore 文件。是我添加到新的 git repo



的第一个文件因此,编辑 .gitignore 在一行上至少包含 *〜(也许另一行包含 *。o 如果你有对象文件等)。然后

  git add .gitignore 

您也可以删除这些文件,例如与 rm -vi ** / *〜 rm -vi *〜* / *〜(或使用 find ) - 或许也是如 Chris Maes回答,使用 git rm


Everytime I checkout a branch this is what happens:

M   src/note/views.py~
D   src/static/assets/css/inside.css~
D   src/templates/index.html~
D   src/templates/note/create.html~
D   src/templates/note/list.html~
D   src/templates/note/unite.html~

Which is quite irritating and makes me sick. How do I remove these files forever?

解决方案

You probably want to ignore them (these are backup files written by your editor). Have a .gitignore file.

Actually .gitignore is the first file I am adding to a fresh new git repo

So, edit .gitignore to contain at least *~ on a line (and perhaps another line with *.o if you have object files, etc). Then

git add .gitignore

You might also remove these files, e.g. with rm -vi **/*~ or rm -vi *~ */*~ (or use find) - perhaps also, as Chris Maes answered, using git rm

这篇关于如何永久删除'〜'文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆