如何忽略文件在〜git中结束?

编程入门 行业动态 更新时间:2024-10-25 08:28:12
本文介绍了如何忽略文件在〜git中结束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的 .gitignore 文件如下所示:

My .gitignore file looks like that:

> cat .gitignore .bundle db/*.sqlite3 log/*.log tmp/**/* *~

但是,git不会忽略以〜结尾的文件:

But, git doesn't ignore the files ended with ~:

> git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: app/views/jobs/_form.html.erb # modified: app/views/jobs/_form.html.erb~ # modified: public/stylesheets/jobs_new_edit.css~

这可能是什么原因?

What could be th ereason for that?

推荐答案

modified 表示你已经在repo中提交了该文件。您应该先将其删除,然后再将其忽略。

modified means you have the file committed in the repo already. You should remove it first, then it will be ignored for addition.

更多推荐

如何忽略文件在〜git中结束?

本文发布于:2023-11-02 08:30:08,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:结束   文件   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!