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

franka picture franka · Mar 30, 2012 · Viewed 19.7k times · Source

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

Answer

Martin Geisler picture Martin Geisler · Mar 30, 2012

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.