简体   繁体   English

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

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

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 文档中找不到任何关于此的信息

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.如果您转到 Bitbucket 上的分叉,您可以单击“比较分叉”以进入您看到传入和传出提交的页面。 If you go to the "incoming" tab, you will see instructions like如果您转到“传入”选项卡,您将看到类似的说明

$ git remote add <remote_name> git@bitbucket.org:<upstream>/<repo>.git
$ git fetch <remote_name>
$ git checkout master
$ git merge <remote_name>/master

which correspond closely to the GitHub instructions.与 GitHub 说明紧密对应。

  1. Goto your fork on bitbucket在 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使 URL 看起来像这样: https://bitbucket.org/<user name>/<fork name>/branches/compare : 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在你的 fork 和所有者的 repo 中选择正确的分支
  6. Click Compare点击比较
  7. Click Merge单击合并

Ahhhhhh here comes the easiest way.... Ahhhhhh 最简单的方法来了......
1. Go to your fork repo. 1. 去你的 fork 仓库。
2. Select Repository Settings tab. 2. 选择存储库设置选项卡。
3. Select Fork Syncing tab. 3. 选择叉同步选项卡。
4. Deselect automatic sync . 4.取消选择自动同步
5. Re-select automatic sync . 5.重新选择自动同步

Life just got easy with this hack.有了这个黑客,生活变得轻松了。

On the left hand side, the repository details panels shows a SYNC button IF AND ONLY IF there is any commit behind在左侧,存储库详细信息面板显示 SYNC 按钮 IF AND ONLY IF 后面有任何提交

在此处输入图片说明

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM