使用 Mercurial 克隆存储库时,您可以传递 -U/--noupdate 标志来创建没有工作副本的克隆。如果我忘记在克隆时传递此标志,我可以删除工作副本吗?如果是这样,怎么办?
这在概念上类似于 这个 git 问题,但适用于 Mercurial。
When cloning a repository with mercurial you can pass the -U/--noupdate flag to create a clone with no working copy. Can I remove the working copy if I forget to pass this flag at clone time? And if so, how?
This is conceptually similar to this git question, but for mercurial.
发布评论
评论(2)
Mercurial wiki 上的文档对裸存储库进行了以下说明:
空修订版类似于您刚刚完成
hg init
时的空状态。它是修订版 0 的父版本(并且所有非合并修订的第二个父版本),通过更新回它,您将再次获得一个空的工作副本。该链接可能看起来很讽刺:
Documentation at Mercurial wiki says following about bare repositories:
The null revision is similar to the empty state you have when you have just done
hg init
. It is the parent of revision 0 (and the second parent of all non-merge revisions) and by updating back to it you again get an empty working copy.The link may look ironic:
这将删除所有“可见”文件(在 *nix 下)。由于 Mercurial 存储库存储在“隐藏”文件
.hg
中,因此不会被触及。不幸的是,您自己的任何隐藏文件(例如.hgignore
)也不会。要恢复工作副本,我确信有一个
hg update
标志可以工作,但这也可以:This removes all "visible" files (under *nix). Since the Mercurial repository is stored in the "hidden" file
.hg
, it won't be touched. Unfortunately, neither will any hidden files of your own, such as.hgignore
.To restore the working copy, I'm sure there's an
hg update
flag that works, but this will as well: