【发布时间】:2017-09-23 19:31:22
【问题描述】:
我正在尝试直接从 git shell 将特定文件添加到 .gitignore。要忽略的文件是token.mat
如果我输入:
touch .gitignore
然后用文本编辑器手动打开.gitignore并添加
token.mat
保存并关闭,它可以工作,git 忽略它(当我在 git shell 中输入 git status 时,我不再看到 token.mat)
但是,如果我在 git shell 中输入:
touch .gitignore
echo 'token.mat' >> .gitignore
然后 git 不会忽略 token.mat,当我输入 git status 时,我仍然可以看到它。但是,当我使用文本编辑打开 .gitignore 时,我看到列出了 token.mat,它看起来与我手动添加时完全相同。
有谁知道这是为什么,或者我如何直接从 git shell 将文件添加到 .gitignore?
提前感谢您的帮助!
其他细节:
- Windows 7 专业版,服务包 1
- git 版本:2.5.3.windows.1
- 文本编辑器:记事本++
【问题讨论】:
-
文本编辑器是否处理向 git 项目添加/处理文件索引?
标签: git echo gitignore git-shell