Git server to delete the file but keep the local files

Article Source:

https://blog.csdn.net/u012804886/article/details/83059315

Needs analysis
assumed that Bob one day accidentally put a file on the local repository folder A push to a remote GIT server (for example: github, gitlab, gitee) on at this time want to remove the remote repository folder A, but the local do not want to delete. Xiao Ming then ask Alice, how do? Red without hesitation, he said, github, gitlab can not delete it? You directly on the remote server operating it. Ming told red, you may not know, remote operation can only operate a single file, you can not delete a folder, you can not be stupid enough to delete a file. Little Red said, how to do it?

Solution
method

Here folder to delete .setting Case

git rm -r --cached .setting # - cached locally .setting will not delete 
git the commit -m 'the Delete .setting dir' 
git the Push -u Origin Master


Method Two
If the file mistakenly submitted more folders, a method is also more complicated

.Gitignore directly modify the file, filter out unwanted files, and then execute the command

git rm -r --cached .
git add .
git commit
git push  -u origin master

 

Guess you like

Origin www.cnblogs.com/kaerxifa/p/10973731.html