Practical use case of 'git rm' and 'git mv' with git?

戏子无情 提交于 2019-11-30 20:11:51
VonC

git mv and git rm are about updating the index directly. While directly moving or deleting files in the working tree won't immediately affect the index.

The GitFaq does present git mv as:

just a convenience. The effect is indistinguishable from removing the file and adding another with different name and the same content.

git rm and git mv allows you to be more specific/granular about what you're doing. If you've deleted two directories and want to split up those deletions between two commits, you can use git rm to remove only one directory from the staging area, rather than getting them both via git -u

you could do it the way you said, but it sounds like it would be simpler to use git rm and git mv as it's a one-step process.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!