bzr pull 与 bzr 合并

发布于 2024-08-17 07:57:59 字数 792 浏览 3 评论 0原文

我使用 bzr 来完成一个非常简单的任务:获取 GNU Emacs 的开发版本。在最初的 bzr 分支之后,我希望保持本地版本最新。我阅读了有关 bzr pullbzr merge 的文档,但无法理解它。我尝试了bzr merge几天,发现bzr merge经常会导致无法解决的冲突。请注意,我没有进行任何本地更改。 bzr pull 是推荐的方式吗?

编辑1(添加了从Chris Conway窃取的图表):

remote: A --> B --> C --> D
         \                 \
       (branch)           (merge)
           \                  \
local:      \--> A (no change) \--> why conflicts?

我了解git和darcs ,但对bzr一无所知。与 git 或 darcs 的类比会有很大帮助。

编辑2update是否应该仅与checkout一起使用?在 branch 中执行 update 似乎没有做任何事情。

I'm using bzr for a very simple task: getting the development version of GNU Emacs. After the initial bzr branch, I'd like to keep my local version up to date. I read about the documentation on bzr pull and bzr merge, but couldn't make sense out of it. I tried bzr merge for a few days, and found that bzr merge often resulted in unresolvable conflicts. Note that I didn't make any local changes. Is bzr pull the recommended way?

EDIT 1 (added a diagram stolen from Chris Conway):

remote: A --> B --> C --> D
         \                 \
       (branch)           (merge)
           \                  \
local:      \--> A (no change) \--> why conflicts?

I understand git and darcs, but have no knowledge about bzr. Analogies to git or darcs will help a lot.

EDIT 2: Is update supposed to work with checkout only? Doing an update in a branch doesn't seem to do anything.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我是有多爱你 2024-08-24 07:57:59

请注意,我没有制作任何本地
变化。 bzr pull 是推荐的吗
方式?

是的,听起来 bzr pull 是适合您使用的命令。 pull 获取远程源分支并将所有更改从其复制到较旧版本的本地目标分支。 (我在这里使用“远程”和“本地”来表示“源”和“目的地”。任何两个分支都可以,甚至两个本地分支。)

remote: A --> B --> C --> D
         \                 \
       (branch)           (pull)
           \                  \
local:      \--> A (no change) \--> D

仅当两个分支没有时,pull 才有效。 t 发散,即,如果目标的修订版是源的旧修订版。 push 正是相反的操作:它将本地分支中的更改复制到较旧版本的远程分支。

remote: A      (no change)       --> C
         \                      /
       (branch)             (push)
           \                  /
local:      \--> A --> B --> C

当您想要将更改复制到与远程分支不同的本地分支时,可以使用合并。

remote: A --> B --> C --> D
         \                 \  
       (branch)           (merge) 
           \                  \ 
local:      \--> A --> X --> Y --> Z

这里,Z 包括来自 D 的所有更改和来自 Y 的更改。在这种情况下,不可能进行拉动。请注意,您必须在合并提交才能保存新的合并修订,而拉取会自动将分支带到已保存的修订点。

checkout 允许您以类似于 CVS/SVN 的模式使用 bzr:本地分支将“附加”到远程分支; commit将自动push;如果远程分支发生分歧,则提交将失败; 更新只是来自“附加”远程分支的合并

Note that I didn't make any local
changes. Is bzr pull the recommended
way?

Yes, it sounds like bzr pull is the appropriate command for your use. pull takes a remote source branch and copies any changes from it to a local destination branch at an older revision. (I use "remote" and "local" here to mean "source" and "destination." Any two branches will do, even two local branches.)

remote: A --> B --> C --> D
         \                 \
       (branch)           (pull)
           \                  \
local:      \--> A (no change) \--> D

A pull only works if the two branches haven't diverged, i.e., if the revision of the destination is an old revision of the source. push is just the opposite operation: it copies changes in a local branch to remote branch at an older revision.

remote: A      (no change)       --> C
         \                      /
       (branch)             (push)
           \                  /
local:      \--> A --> B --> C

A merge is used when you want to copy changes to a local branch that has diverged from the remote branch.

remote: A --> B --> C --> D
         \                 \  
       (branch)           (merge) 
           \                  \ 
local:      \--> A --> X --> Y --> Z

Here, Z includes all of the changes from D and the changes from Y. A pull is not possible in this case. Note that you must commit after a merge in order to save the new merged revision, whereas a pull automatically brings the branch to a saved revision point.

A checkout allows you to use bzr in a mode that is similar to CVS/SVN: the local branch will be "attached" to a remote branch; commits will be automatically pushed; if the remote branch has diverged, the commit will fail; an update is just a merge from the "attached" remote branch.

柠北森屋 2024-08-24 07:57:59

合并用于合并两个不同的分支,而不是副本(本地和远程)。
使用拉力。

Merge is for merging two different branches, not copies (local and remote).
Use pull.

翻了热茶 2024-08-24 07:57:59

$ bzr 帮助拉

目的:将这个分支变成另一个分支的镜像。

--overwrite 忽略分支之间的差异并无条件覆盖。

如果您想替换本地更改并且只想要您的分支
要匹配远程的,请使用 pull --overwrite。这甚至会起作用
如果两个分支有分歧。

所以你可以使用:

$ bzr pull --overwrite

$ bzr help pull

Purpose: Turn this branch into a mirror of another branch.

--overwrite Ignore differences between branches and overwrite unconditionally.

If you want to replace your local changes and just want your branch
to match the remote one, use pull --overwrite. This will work even
if the two branches have diverged.

so you can use:

$ bzr pull --overwrite

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文