git删除远程仓库的文件或目录,但不删工作区

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wang123459/article/details/85777821

删除aa目录下的1.txt文件:git rm -r --cached aa/1.txt
删除aa目录:git rm -r --cached aa
-r:Allow recursive removal when a leading directory name is given.
–cached:Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.

本地和远程都删除:git rm -r aa/1.txt
git rm -r aa

git commit -m “删除aa目录下的1.txt文件”

git push

猜你喜欢

转载自blog.csdn.net/wang123459/article/details/85777821
今日推荐