在 Git 存储库中,如何正确重命名目录? [英] In a Git repository, how to properly rename a directory?
本文介绍了在 Git 存储库中,如何正确重命名目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我认为应该可以将要重命名的目录复制到具有所需名称的新目录,然后 删除旧目录,以及git add
、git commit
和push
一切.但这是最好的方法吗?
I think it should work to copy the directory to be renamed to a new directory with desired name, and delete the old directory, and git add
, git commit
and push
everything. But is this the best way?
推荐答案
基本重命名(或移动):
Basic rename (or move):
git mv <old name> <new name>
区分大小写的重命名——例如.从 casesensitive
到 CaseSensitive
——你必须使用两个步骤:
Case sensitive rename—eg. from casesensitive
to CaseSensitive
—you must use a two step:
git mv casesensitive tmp
git mv tmp CaseSensitive
...然后是提交和推送将是在 git 存储库中重命名目录的最简单方法.
…followed by commit and push would be the simplest way to rename a directory in a git repo.
这篇关于在 Git 存储库中,如何正确重命名目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文