从存储库中删除文件但将其保留在本地
我想在远程存储库中删除一个文件夹。我想删除它,但将该文件夹保留在我的计算机中
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将暂存目录的删除,但不会触及磁盘上的任何内容。这也适用于文件,例如:
之后您可能需要将
somedir/
或somefile.ext
添加到您的.gitignore
文件中,以便 git不会尝试将其添加回来。Will stage the deletion of the directory, but doesn't touch anything on disk. This works also for a file, like:
Afterwards you may want to add
somedir/
orsomefile.ext
to your.gitignore
file so that git doesn't try to add it back.我只想:
git rm
文件夹,提交更改.gitignore
(或.git/info/excludes< /code>),提交更改
I would just:
git rm
the folder, commit the change.gitignore
(or.git/info/excludes
), commit the change