我已经使用正确的 .gitignore 文件重新初始化了我的存储库,但是我的远程 Heroku 中仍然有 .DS_Store 文件。
git pull heroku master 给出:
我怎样才能一劳永逸地摆脱这些文件?
看起来您已经提交了这些文件。
添加并提交文件后,git 开始跟踪它们。
您有两个主要选项来忽略这些文件。
在您的情况下,您希望使用第一个选项,因此方法如下。
文件
.gitignore指定 Git 应忽略的故意未跟踪的文件。
已被 Git 跟踪的文件不受影响
How to remove commited files and set git to ignore them?您必须删除并提交,然后它们将被忽略。
# remove the commited files:
git rm --cached .DS_Store
# now add the files to the .gitignore and
# commit and push
git commit -m "Removed..."
git push origin <branch>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4149 次 |
| 最近记录: |