Setup and Config
Getting and Creating Projects
Basic Snapshotting
Branching and Merging
Sharing and Updating Projects
Inspection and Comparison
Patching
Debugging
External Systems
Server Admin
Guides
- gitattributes
- Command-line interface conventions
- Everyday Git
- Frequently Asked Questions (FAQ)
- Glossary
- Hooks
- gitignore
- gitmodules
- Revisions
- Submodules
- Tutorial
- Workflows
- All guides...
Administration
Plumbing Commands
-
2.50.0
2025-06-16
- 2.44.1 → 2.49.0 no changes
-
2.44.0
2024-02-23
- 2.43.1 → 2.43.6 no changes
-
2.43.0
2023-11-20
- 2.39.1 → 2.42.4 no changes
-
2.39.0
2022-12-12
- 2.10.5 → 2.38.5 no changes
-
2.9.5
2017-07-30
- 2.1.4 → 2.8.6 no changes
-
2.0.5
2014-12-17
概述
git mv [-v] [-f] [-n] [-k] <source> <destination> git mv [-v] [-f] [-n] [-k] <source>… <destination-directory>
描述
移动或重命名一个文件、目录或符号链接。
In the first form, it renames <source>, which must exist and be either a file, symlink or directory, to <destination>. In the second form, <destination-directory> has to be an existing directory; the given sources will be moved into this directory.
在移动成功完成后,索引就会被更新,但更改仍需要进行提交才能生效。
子模块
Moving a submodule using a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will update the gitfile and core.worktree setting to make the submodule work in the new location. It also will attempt to update the submodule.<name>.path
setting in the gitmodules[5] file and stage that file (unless -n
is used).
漏洞
每当父工程更新导致子模块移动时(例如,在移动之前和之后的提交之间切换时),旧位置将保留一个陈旧的子模块检出,并在新位置出现一个空目录。要在新位置重新填充子模块,用户必须运行 "git submodule update"。只有在旧目录使用 gitfile 时,删除旧目录才是安全的,否则子模块的历史记录也将被删除。当实现递归子模块更新时,这两个步骤将变得不再需要。
GIT
属于 git[1] 文档