Safer branching

By on October 6, 2016

A comic in which a developer commits directly to master, temporarily breaking the build. Another developer has the misfortune to fetch master whilst broken, and creates a feature branch from the broken commit. This causes confusion later on when the tests fail in an area of the code that they had not modified on the branch. Had the developer created the branch via the Bitbucket UI, they would have been warned that the branch they were creating a commit from was currently failing the tests.

Try Bitbucket Pipelines

4 Comments

  • Chris Emerson
    Posted October 6, 2016 at 11:18 am | Permalink

    Why don’t you make a feature that informs you of this when you push a branch up via the command line, just like you do for pull request URIs?

    Because there’s no way I’m loading my browser, loading the website, navigating the UI and typing into a box to create a branch when I am so much quicker on the command line…

    • Tim Pettersen
      Posted October 6, 2016 at 11:29 am | Permalink

      For the command-line I use a post-checkout hook to display the Bitbucket build status of a commit whenever I switch commits:

      https://bitbucket.org/tpettersen/bitbucket-build-status-hook

      That way if master is broken before starting on a new feature, I get a notification if the tip of master is broken (or still building).

  • Robert Watkins
    Posted October 6, 2016 at 1:52 pm | Permalink

    Um… the build took 5 minutes to break. During that 5 minute window, that “broken build” flag wouldn’t have been there.

    • Tim Pettersen
      Posted October 6, 2016 at 2:21 pm | Permalink

      LOL, good catch.

      Just imagine there’s a 5 minute gap between the “git pull” and “git checkout -b” (or more realistically, that Bob took a less negligible time to fix the build).