Remove and untrack files from repo but keep them on remote server

后端 未结 1 1034
渐次进展
渐次进展 2021-01-15 05:38

I\'ve done some searching but either I don\'t understand exactly how this works or I\'m not finding what I need.

I have a production server and I have my local devel

相关标签:
1条回答
  • 2021-01-15 06:11

    You understand it correctly. You can, however, make copies of these files on the production server, pull the local repo (which will erase the originals), and then restore the files from the copy. After that these files will not be tracked, so no (usual) git operations, including any further pulls, are going to overwrite or remove them.

    edit:

    Actually the author of the question proposed a much nicer solution, that is using git rm --cached on the production server, which will remove the files from index (allowing them to be removed from the repository in the next commit), but preserving them in the working tree.

    0 讨论(0)
提交回复
热议问题