[英].gitignore for file extension( ~) not working
I want to ignore all the files that ends with ~. 我想忽略所有以〜结尾的文件。
My .gitignore fille is 我的.gitignore fille是
*~ *〜
I have placed .gitignore file as below. 我将.gitignore文件放置如下。
sci2c| sci2c | |2.3.1 |various files and folders |.gitignore
| 2.3.1 |各种文件和文件夹| .gitignore
Its not ignoring the files thats ends with ~ in all directories. 它不忽略所有目录中以〜结尾的文件。
Please help. 请帮忙。
*~.*
应该适用于任何扩展名上的所有此类文件。
If the file is already added in to repository then you need to remove them. 如果文件已添加到存储库中,则需要将其删除。 Git thinks of its data more like a set of snapshots of a miniature filesystem.
Git认为其数据更像是一组微型文件系统的快照 。 Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.
每次您提交或将项目状态保存在Git中时,它基本上都会拍下当时所有文件的样子,并存储对该快照的引用。 To be efficient, if files have not changed, Git doesn't store the file again, just a link to the previous identical file it has already stored.
为了提高效率,如果文件没有更改,Git不会再次存储该文件,而只是指向它已经存储的先前相同文件的链接。 Git thinks about its data more like a stream of snapshots.
Git更像是快照流来思考其数据。 So you need to remove the already added files then
所以您需要先删除已经添加的文件
git rm --cached file-1 file-2..... file-n
git rm-缓存文件1 file-2 ..... file-n
Then the files listed in gitignore will work as expected. 然后,gitignore中列出的文件将按预期工作。 Check the notes section in the Git Documentation
查看Git文档中的注释部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.