git rm 和 git rm --cached 的区别

 

git rm file
git commit -m "xxx"
git push origin master

删除本地及仓库中的文件

 

git rm --cached file
git commit -m "xxx"
git push origin master

删除仓库中的文件,保留本地的文件

 

如果使用 git rm --cached 删除了仓库中的文件,而且后续不想跟踪此文件,只需将此文件加入 .gitignore 中即可。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-06-07
  • 2021-12-27
猜你喜欢
  • 2022-03-08
  • 2021-05-31
  • 2022-03-06
  • 2022-12-23
  • 2021-05-24
  • 2021-08-30
相关资源
相似解决方案