Git: How to remove file from index without deleting files from any repository

前端 未结 7 1906
情深已故
情深已故 2020-11-30 17:17

When you use

git rm --cached myfile

it doesn\'t delete from the local filesystem, which is the goal. But if you\'ve already versioned and c

7条回答
  •  Happy的楠姐
    2020-11-30 17:53

    My solution is to pull on the other working copy and then do:

    git log --pretty="format:" --name-only -n1 | xargs git checkout HEAD^1
    

    which says get all the file paths in the latest comment, and check them out from the parent of HEAD. Job done.

提交回复
热议问题