在Git仓库中,如何正确地重命名目录? [英] In a Git repository, how to properly rename a directory?
本文介绍了在Git仓库中,如何正确地重命名目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Git仓库中,如何正确地重命名目录?我认为应该将要重命名的目录复制到具有所需名称的新目录,并删除旧目录和 git add
, git commit
和 push
一切但是这是最好的方法吗?
In a Git repository, how to properly rename a directory? 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
- 您必须使用两步:
Case sensitive rename—eg. from casesensitive
to CaseSensitive
—you must use a two step:
git mv casesensitive tmp
git mv tmp CaseSensitive
...之后是commit和push将是在git repo中重命名目录的最简单的方法。
…followed by commit and push would be the simplest way to rename a directory in a git repo.
这篇关于在Git仓库中,如何正确地重命名目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文