Gitignore 星号代字号

标签 git gitignore

我有一个包含以下行的开源项目的 .gitignore 文件:

*~

这行 - 星号后跟波浪号 - 在 .gitignore 文件的上下文中是什么意思?

我试过谷歌搜索但无济于事。

最佳答案

参见 https://git-scm.com/docs/gitignore “模式格式”部分,在这种情况下:

If the pattern does not contain a slash /, Git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).

所以它会忽略所有名称以波浪号结尾的文件。

关于Gitignore 星号代字号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36478324/

相关文章:

svn - svn :ignore modify? 是哪个文件

eclipse - 如何在 EGit 中使用 utf8 文件名设置 git

git - 未跟踪的文件仍然出现在 git status 中

node.js - 更改 git 分支时切换 node_modules 文件夹

matlab - 使用 MATLAB 和 Simulink 时,我应该将哪些文件添加到 .gitignore?

terraform - gitignore .tfvars 但不是 .auto.tfvars

javascript - 用于发布的 Angular Node 模块的版本控制

git - 我如何知道我安装了哪些版本的 MinGW32 和 MinGW64(通过 Git Bash)?

git - 允许所有用户在 TFS-GIT 中创建一个 repo

git - .gitignore - 忽略目标文件夹中除 1 个 JAR 文件之外的所有文件