目录 搜索
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
文字

命名

git-mv  - 移动或重命名文件,目录或符号链接

概要

git mv <options>… <args>…

描述

移动或重命名文件,目录或符号链接。

git mv [-v] [-f] [-n] [-k] <source> <destination>git mv [-v] [-f] [-n] [-k] <source> ... <destination directory>

在第一种形式中,它将 <source> 重命名为 <destination> ,它必须存在,并且可以是文件,符号链接或目录。在第二种形式中,最后一个参数必须是现有目录; 给定的源将被移动到这个目录中。

成功完成后更新索引,但仍必须提交更改。

选项

-f   --force

即使目标存在,也要强制重命名或移动文件

-k

跳过移动或重命名会导致错误情况的操作。当源既不存在也不受 Git 控制时,或者除非-f给出,否则会覆盖现有文件时发生错误。

-n   --dry-run

没做什么; 只显示会发生什么

-v   --verbose

报告移动文件的名称。

子模块

使用 gitfile 移动子模块(意味着它们使用 Git 1.7.8 或更高版本进行克隆)将更新 gitfile 和 core.worktree 设置,以使子模块在新位置工作。它还会尝试更新 gitmodules [5] 文件中的 submodule 。<name> .path 设置并对该文件执行阶段操作(除非使用了-n )。

Bugs

每次超级项目更新移动填充的子模块时(例如,在移动之前和之后在提交之间切换时)旧的子模块检出将保留在旧位置,并且新的位置将出现空目录。要在新位置再次填充子模块,用户必须在之后运行 “git submodule update” 。删除旧目录仅在使用 gitfile 时才是安全的,否则子模块的历史记录也会被删除。当递归子模块更新已经实施时,这两个步骤都将被废弃。

上一篇: 下一篇: