Syncing and merging come to Bitbucket

By on February 4, 2013

When developing on a feature branch or a fork, your code can often get out of date. There are a number of reasons this might happen:

Have you ever wished there was a simple way to update your feature branches and forks with the most recent commits from mainline? Bitbucket now automates syncing your projects without ever needing to go to the command line.

Managing feature branches

We recently added the feature branches tab to the commits page, allowing you to see what branches are ahead of your main branch. From the feature branches tab, you can now keep these feature branches in sync with your main branch with one click.

Sync branch screenshot

Merging regularly helps avoid nasty merge conflicts and lets you focus on developing new features. If you decide you’re done with a feature branch (or just forgot to close a branch after merging in a pull request), you can also delete it directly from the feature branches page.

No fork left behind

Sync fork dialog screenshot

When you’ve forked project, it can be tedious to keep up to date with the upstream repository. Bitbucket now informs you when your fork is behind, and you get the option to instantly merge in those upstream changes with a single click.

Merging in the compare view

For cases where you need to quickly merge in a branch without making a pull request, you can now do the merge directly from the compare view.

Merge button screenshot

On the Bitbucket team, when we make a pull request with hot fixes, it goes on our production branch. When we accept the pull request, we go to the compare view and merge production into our staging branch, making sure the fix makes it out both externally and internally.

Being able to sync your branches and merge through the compare view lets you manage your branches in Bitbucket from start to finish.

Sync and merge with Bitbucket

Sign up free for 5 users today using your Google, Facebook or GitHub account.


  • Posted February 5, 2013 at 7:26 pm | Permalink

    like this +1

  • Posted February 7, 2013 at 12:53 am | Permalink

    Very nice addition! No more infinite pulling/rebasing. Tx!

  • Posted February 7, 2013 at 5:50 am | Permalink

    Pretty damn handy, especially when you’re forking a popular open source project. Your fork is lagging after a couple of hours.

  • Tim Walling
    Posted February 7, 2013 at 12:04 pm | Permalink

    Are these features available via the API? Last I checked I couldn’t find any support for doing a merge via API which is something we really like using on Github.

    • Cam
      Posted August 18, 2013 at 11:27 pm | Permalink

      I agree – just created jira 7954 for this…

    • wsilva
      Posted June 21, 2016 at 8:31 am | Permalink

      after 3 years is there any update? @google-5ff60cab625ccb56144502f57e77f4b8:disqus ? @disqus_GeK6uRKGIK:disqus ? We still can not merge branches via API? I am trying API version 2 and could not find how to do this.

  • Mark V.
    Posted February 7, 2013 at 12:14 pm | Permalink

    Awesome. <3 Bitbucket.

  • Patrik Holmberg
    Posted February 7, 2013 at 12:39 pm | Permalink

    The only problem I have with Bitbucket syncing is that it creates an unnecessary commit in the git history. You can bypass that however by fetching it to local and rebase it.

    • Posted March 26, 2013 at 8:13 am | Permalink

      You should probably not rebase but reset if you’re running 223 commits behind

  • S Barlow
    Posted February 7, 2013 at 2:18 pm | Permalink

    When the GUI says that it cannot merge due to conflicts. How do I jump out to then resolve them?

    • Chris Geroux
      Posted May 23, 2013 at 6:42 am | Permalink

      Seems it only shows the conflicts but doesn’t seem to allow any method of editing and continuing the commit. I have found that manually doing the merge and resolving the conflicts on the command line does it.

      • Jordan England
        Posted July 16, 2013 at 7:29 am | Permalink

        Yep. I noticed the same thing. It works great, as long as there aren’t any conflicts.

      • Akash
        Posted April 29, 2014 at 2:36 am | Permalink

        Chris i am also facing the same issue,
        when i m trying to commit my code in git, its showing some conflict message. the added lines are

        +<<<<<<>>>>>> source:95de515e0203585db3c4f1084e37ade6dcc08ed2
        can you please help me out to find the solution for that?


  • Posted April 25, 2013 at 12:55 am | Permalink

    Why does my fork not see the new branch created in the ‘main’ code base after a sync?

  • Vikram Jit Singh
    Posted June 27, 2013 at 2:53 am | Permalink

    I am not getting these options using the setting button. The setting button takes me to the settings page. Any configuration needed?

  • Posted May 21, 2014 at 10:47 am | Permalink

    What does syncing actually *do*, so if I want to do it via the command line, I can do it there as well? (I’d also like to know what’s going on behind the scenes so I don’t screw anything up!)

    • savi
      Posted June 4, 2014 at 1:01 am | Permalink

      I believe it is some combination of fetch upstream and merge with origin branch… maybe someone from bitbucket development team can tell better, even I wanna know the command line way to do it

  • savi
    Posted June 4, 2014 at 1:09 am | Permalink

    I will also like to have a option where I can select the branch from original repository with which I want to sync a branch from my fork repo

  • Reitz
    Posted October 31, 2014 at 5:38 am | Permalink

    If anyone wants to know, doing it via console would be:

    git checkout master
    git pull
    git checkout yourBranch
    git merge master

  • Posted February 10, 2015 at 6:39 am | Permalink

    How does this work when I make a private repo from a public repo. I just wanted some personalized changes. I go to commits and see no such options.

  • Gulshan Maurya
    Posted June 15, 2016 at 11:16 pm | Permalink

    Sync and Merging works great with Bitbucket.
    There should be one more option to resolve conflict interface where user can see diff between both version of files and make decision on what code should be accepted there.
    I am using Netbeans IDE that have easy interface to resolve merge conflict.