Github - Basic Operation Guide

Delete files/folders in repositories

  On GitHub, you can only delete repositories through visual operations, but you cannot delete a folder or file in the repository. This is very inhumane, so you can only use commands to solve it.

After cloning the project in the warehouse with the git clone command, use the following command in the changed folder:

  1. Pull the project from the remote warehouse
    git pull origin master                  
    
  2. Delete the specified folder. What is deleted here is the test folder in the src directory. When used, it will src/test/be replaced with the deleted file you need.
    git rm -r --cached src/test/        
    
  3. Submit deletion instruction and add operation instructions
    git commit -m '删除了src/test'        # 提交,添加操作说明
    

Guess you like

Origin blog.csdn.net/qq_16775293/article/details/116521368