git忽略vim临时文件 [英] git ignore vim temporary files

查看:169
本文介绍了git忽略vim临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使git忽略所有目录中vim产生的临时文件(无论是在整个系统中,还是在本地为单个项目),正确的方法是什么? 解决方案

Vim临时文件以〜结尾,因此您可以添加到文件 .gitignore

  *〜

Vim还创建交换文件有swp和swo扩展名。

  *。swp 
* .swo

这会忽略单个项目中的所有vim临时文件



如果你想要在全球范围内完成此操作,您可以在家中创建一个.gitignore文件(可以指定其他名称或位置),然后使用以下命令:

  git config --global core.excludesfile〜/ .gitignore 

然后你需要将要忽略的文件添加到该文件中。


What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?

解决方案

Vim temporary files end with ~ so you can add to the file .gitignore the line

*~

Vim also creates swap files that have the swp and swo extensions. to remove those use the lines:

*.swp
*.swo

This will ignore all the vim temporary files in a single project

If you want to do it globally, you can create a .gitignore file in your home (you can give it other name or location), and use the following command:

git config --global core.excludesfile ~/.gitignore

Then you just need to add the files you want to ignore to that file

这篇关于git忽略vim临时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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