git Bitbucket:更新一个分支以合并主存储库的更改?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9944898/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:41:41  来源:igfitidea点击:

Bitbucket: Update a fork to merge changes of master repo?

gitforkdvcsbitbucket

提问by franka

I am working with a bitbucket git repo I have read-only access to, so I created a fork to work on my features.

我正在使用一个我拥有只读访问权限的 bitbucket git repo,所以我创建了一个 fork 来处理我的功能。

Question: How do I update my fork to include changes made to the original repo made by the owner?

问题:如何更新我的 fork 以包含所有者对原始 repo 所做的更改?

On github, it seems one has to do the following, so I suspect it's a similar to this:

在github上,似乎必须执行以下操作,所以我怀疑它与此类似:

 $ git remote add upstream git://github.com/octocat/Spoon-Knife.git
 $ git fetch upstream
 $ git merge upstream/master

I couldn't find any information on this in the Bitbucket Documentation for forking

我在用于分叉Bitbucket 文档中找不到任何关于此的信息

回答by Martin Geisler

Just like GitHub, you have to pull the commits down to your own machine, merge, and then push them back to your fork on Bitbucket.

就像 GitHub 一样,你必须将提交下拉到你自己的机器上,合并,然后将它们推回到你在 Bitbucket 上的分支。

If you go to your fork on Bitbucket you can click "compare fork" to get to a page where you see incoming and outgoing commits. If you go to the "incoming" tab, you will see instructions like

如果您转到 Bitbucket 上的分叉,您可以单击“比较分叉”以进入您看到传入和传出提交的页面。如果您转到“传入”选项卡,您将看到类似的说明

$ git remote add <remote_name> [email protected]:<upstream>/<repo>.git
$ git fetch <remote_name>
$ git checkout master
$ git merge <remote_name>/master

which correspond closely to the GitHub instructions.

与 GitHub 说明紧密对应。

回答by soch guru

  1. Goto your fork on bitbucket
  2. Click the Branches menu from the left navigation pane
  3. Click on the "..." button to the right of the branch and select "Compare". Or, in the url add the word “compare”. So that the URL looks like this: https://bitbucket.org/<user name>/<fork name>/branches/compare
  4. Click on the switch icon (black up/down arrows between the branch segments) so that the blue arrow is pointing into your fork
  5. Select the correct branches in your fork and the owner's repo
  6. Click Compare
  7. Click Merge
  1. 在 bitbucket 上转到你的叉子
  2. 单击左侧导航窗格中的分支菜单
  3. 单击分支右侧的“...”按钮并选择“比较”。或者,在网址中添加“比较”一词。使 URL 看起来像这样:https://bitbucket.org/<user name>/<fork name>/branches/compare
  4. 单击开关图标(分支段之间的黑色向上/向下箭头),使蓝色箭头指向您的叉子
  5. 在你的 fork 和所有者的 repo 中选择正确的分支
  6. 点击比较
  7. 单击合并

回答by Vinod Kumar

Ahhhhhh here comes the easiest way....
1. Go to your fork repo.
2. Select Repository Settingstab.
3. Select Fork Syncingtab.
4. Deselect automatic sync.
5. Re-select automatic sync.

Ahhhhhh 这是最简单的方法....
1. 转到您的 fork仓库。
2. 选择存储库设置选项卡。
3. 选择叉同步选项卡。
4.取消选择自动同步
5.重新选择自动同步

Life just got easy with this hack.

有了这个黑客,生活变得轻松了。

回答by Andreas

In the latest version there is a Repository-Detailsbox on the right side with a sync button if the root has unmerged updates.

在最新版本中,如果根目录有未合并的更新,则右侧有一个Repository-Details框和一个同步按钮。