Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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

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

 $ 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

like image 341
franka Avatar asked Mar 30 '12 14:03

franka


People also ask

How do you merge changes in forked repo with master?

Simply push your development branch to the forked remote repository and create the pull request as described in the linked article. The owner of the original repository can then add your repository as a new remote repository, fetch your changes and merge your development branch back into the master branch.

How do I update my forked master repository?

Go to your fork, click on Fetch upstream , and then click on Fetch and merge to directly sync your fork with its parent repo. You may also click on the Compare button to compare the changes before merging.

Can you update a forked repo?

To sync your forked repo with the parent or central repo on GitHub you: Create a pull request on GitHub.com to update your fork of the repository from the original repository, and. Run the git pull command in the terminal to update your local clone.


2 Answers

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.

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

$ 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.

like image 63
Martin Geisler Avatar answered Sep 28 '22 05:09

Martin Geisler


  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
like image 32
soch guru Avatar answered Sep 28 '22 05:09

soch guru