Remove file from the repository but keep it locally

后端 未结 2 1723
自闭症患者
自闭症患者 2020-12-07 07:02

I have a folder which I\'d like to remove in my remote repository. I\'d like to delete it, but keep the folder in my computer

2条回答
  •  既然无缘
    2020-12-07 07:15

    git rm --cached -r somedir
    

    Will stage the deletion of the directory, but doesn't touch anything on disk. This works also for a file, like:

    git rm --cached somefile.ext
    

    Afterwards you may want to add somedir/ or somefile.ext to your .gitignore file so that git doesn't try to add it back.

提交回复
热议问题