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.

  • http://stripbandunk.com/ Eko Kurniawan Khannedy

    like this +1

  • http://twitter.com/marcodejong Marco de Jong

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

  • http://www.dirtymonkey.co.uk/ Matt Stevens

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

  • Tim Walling

    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

      I agree – just created jira 7954 for this…

  • Mark V.

    Awesome. <3 Bitbucket.

  • Patrik Holmberg

    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.

    • http://twitter.com/jtaal Jaap Taal

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

  • S Barlow

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

    • Chris Geroux

      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

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

      • Akash

        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?

        Thanks
        AKash

  • http://www.facebook.com/MikeyDalzell Mikey Dalzell

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

  • Vikram Jit Singh

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

  • http://edkolis.exofire.net Edward Kolis

    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

      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

    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

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

    git checkout master
    git pull
    git checkout yourBranch
    git merge master