我的项目是如此结构
root
.gitignore
-src
- config.ts
-dist
- config.js
我有一个像这样的.gitignore
文件(我只显示前两行)
config.ts
config.js
我看到的是config.ts
(显示src文件夹)实际上被忽略而不保存在git上,而config.js
(存在于dist文件夹中)不被忽略,而且实际上是保存在git上。
关于我做错了什么的任何建议?
如果要从git cache中删除所有被忽略的文件并将其推送到origin,请按照以下命令操作:
git rm -r --cached .
git add .
git commit -m 'Removed all files that are in the .gitignore'
git push origin master
你的.gitignore文件是这样的:
dist/config.js
config.js
可能已经被git跟踪了,应该首先进行跟踪:
git rm dist/config.js