git 删除文件

添加一个文件并提交版本库中   touch test.php  创建一个文件

                git add test.php 添加到暂存区 

                git commit -m "test delete"   提交到版本库

这时候在本地删除

此时如果是误删可以通过命令git checkout -- test.php 从版本库下载文件到本地

如果是真的想删除文件 git rm <filename> 

再通过git commit -m "remove" 提交删除到版本库中

原文地址:https://www.cnblogs.com/binxyz/p/7219913.html