Git 删除某个远端分支的某个文件/文件夹

在本地打开Git bash,然后执行一下操作即可:

git rm -r --cached ceshi #--cached不删除本地的测试
git commit -m 'delete .setting dir'
git push -u origin master

最后一步push的时候报错:

$ git push -u origin dev
To http://1.2.20.2/AiOPS/A-Audit/xxx.git
 ! [rejected]        dev -> dev (fetch first)
error: failed to push some refs to 'http://1.2.20.2/AiOPS/A-Audit/xxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


意思是要合并本地的文件和远程的文件,然后才能继续上传新文件。

1、先拉下来,会自动合并的(不用操心)

git pull origin dev

2、再上传

git push -u origin dev

哦可

猜你喜欢

转载自blog.csdn.net/xiaozhaoshigedasb/article/details/91371170