Bazaar - 删除所有本地更改

时间:2014-12-23 15:32:57

标签: bazaar

bzr文档说明了http://doc.bazaar.canonical.com/bzr-0.10/bzr_man.htm

bzr update :...如果您要放弃本地更改,可以执行以下操作: 更新后bzr revert代替bzr commit


然而,这不是我得到的。我在我的仓库中有新文件,我想要的是在我的工作目录中拥有最新版本,并让bzr status显示任何更改内容。

这可能吗?

1 个答案:

答案 0 :(得分:2)

首先,您正在查看一个极其旧版本的文档。 从版本2.6(当前稳定), bzr update的描述更长,更不同:

Description:
  This will perform a merge of the destination revision (the tip of the
  branch, or the specified revision) into the working tree, and then make
  that revision the basis revision for the working tree.

  You can use this to visit an older revision, or to update a working tree
  that is out of date from its branch.

  If there are any uncommitted changes in the tree, they will be carried
  across and remain as uncommitted changes after the update.  To discard
  these changes, use 'bzr revert'.  The uncommitted changes may conflict
  with the changes brought in by the change in basis revision.

  If the tree's branch is bound to a master branch, bzr will also update
  the branch from the master.

  You cannot update just a single file or directory, because each Bazaar
  working tree has just a single basis revision.  If you want to restore a
  file that has been removed locally, use 'bzr revert' instead of 'bzr
  update'.  If you want to restore a file to its state in a previous
  revision, use 'bzr revert' with a '-r' option, or use 'bzr cat' to write
  out the old content of that file to a new location.

  The 'dir' argument, if given, must be the location of the root of a
  working tree to update.  By default, the working tree that contains the
  current working directory is used.

Aliases:  up
See also: pull, status-flags, working-trees

你的问题不是很清楚。 当您以集中模式工作时, 你有一个用bzr checkout创建的工作树, bzr update命令将引入中央存储库中添加的新修订版。

如果您的工作树在bzr status之前是干净的(bzr update没有显示任何更改), 然后你的工作树将更新到最新版本(因为它在中央服务器上), 你的工作树仍然干净。

如果您的工作树在bzr update之前没有清理, 那么Bazaar会尝试将服务器上的新版本合并到您的工作树中, 和冲突可能发生。 如果您所做的更改与新版本的更改完全相同, 然后你会得到一棵干净的工作树,这是非常罕见的。 最常见的, 如果您的工作树在bzr update之前发生了变化, 它很可能会发生变化,也可能发生冲突。 bzr status会告诉你它们是什么。 在运行bzr update之前,最好没有挂起的更改。