如何忽略文件在〜git中结束? [英] How to ignore files ended with ~ in git?

查看:132
本文介绍了如何忽略文件在〜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中结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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