How can I delete a file from a Git repository?

后端 未结 24 2268
無奈伤痛
無奈伤痛 2020-11-22 13:41

I have added a file named \"file1.txt\" to a Git repository. After that, I committed it, added a couple of directories called dir1 and dir2

24条回答
  •  旧巷少年郎
    2020-11-22 14:06

    Another way if you want to delete the file from your local folder using rm command and then push the changes to the remote server.

    rm file1.txt
    
    git commit -a -m "Deleting files"
    
    git push origin master
    

提交回复
热议问题