老项目添加 gitignore

2024-03-24  本文已影响0人  前行哲

在给老项目添加 .gitignore 文件时,如果你已经有文件被跟踪并提交到了仓库,那么这些文件将不会被 .gitignore 文件自动忽略。为了从 Git 中移除这些文件并使 .gitignore 文件生效,需要运行以下命令:

git rm -r --cached .
git add .
git commit -m "Remove tracked files"
上一篇 下一篇

猜你喜欢

热点阅读