Skip to content

[Feature Tracker - RBB] Compare Branches Feature tracker #3956

Closed

Description

@nerdneha

Purpose

When working on a local branch, I should be able to get a clear understanding of the commits I've made and how that compares to master or any other target branch. I can understand how I've diverged from a branch and, if I'm behind that branch by any number of commits, I can pull that branch's commits into my branch.

  • notifications around diverging from master branch and proactively detecting merge conflicts is in a later release
  • continued from initial discussion here: Relationship between branches #2639

Dependencies:

Designs below - #3956 (comment)

Activity

  1. added this to the milestone on Feb 7, 2018
  2. iAmWillShepherd commented on Feb 7, 2018

    @iAmWillShepherd
    Contributor

    For some additional context, here's @donokuda's mockups from #2639

    Design time! 😄 Here are a couple problems we are aiming to solve with comparing between two branches:

    • There currently isn't a way to see how far we've diverged from a branch. As a result, it's easy for our working branch to diverge from a default branch (such as master) over time.
    • There's no easy to see what kind of changes are about to be brought in. This also adds to the difficulty of not being able to see if there are any overlapping work.

    image

    started off with a version where I played around with a graph/timeline/subway map visualization to show which commits existed on which branch. The goal at the time was to be able to visualize the result of a merge (as well as understand which specific commits would be brought in:

    After some discussion, we've agreed on some of the limitations of that design:

    • The graph doesn't offer any value and (not seen in the crop) doesn't accurately represent events such as merges.
    • We're not convinced of the value of showing all of the commits
    • We're losing precious horizontal space

    Fast-forward a few rounds of back and forth designing, we landed on a flow on what we think comparing (and merging upstream changes) could look like:

    screen shot 2017-09-20 at 9 27 45 am

    Comparing & Merging Flow

    1. When it's time to see how far a working branch has diverged from another, the developer will click into the "Compare" tab (formerly "History"). When there's initially no branch being compared to, we'll display the working branch's history.
    2. Clicking on the "Choose a branch..." will open a little dropdown where the developer can search for a branch to compare.
    3. After selecting a branch, the list will filter down to only the commits that the working branch is missing from the target branch. From there, the developer can choose to merge those commits into their working branch, or they can stop comparing by selecting "None" in the branch dropdown.

    Another problem we plan on tackling for 1.1 is merge conflict. We thought that the merge section could be an opportunity to surface a conflict ahead of time instead of presenting an error after clicking "merge." We will still allow them to attempt a merge, and we'll then kick off into the merge conflict resolution flow.

    screen shot 2017-09-20 at 9 28 20 am

  3. iAmWillShepherd commented on Feb 7, 2018

    @iAmWillShepherd
    Contributor

    For some additional context, here's @niik on the state of the design.

    Just a quick update here. We still have some work to do here. Those mocks are some initial explorations but we don't feel like we're done or that we've addressed the whole problem yet. Please bear with us as we try to figure this out.

    I think all those mocks address the case where my comparison branch is ahead of my branch. I'm curious if you've thought about the flip side where my branch is ahead.

    Our current thinking around this is that the notification part (which haven't been described fully yet) will focus on the behind scenario. We want to focus on the forward momentum primarily. That said we absolutely want the compare view to be able to answer the questions you've described here but our current thinking is that it will be an explicit action and not something where the app automatically informs you of what's been going on in your branch.

    So, to summarize. Our main focus here is the scenario where something has happened on master and you don't necessarily know about it. We want to surface that you're no longer up to date and easily see what's changed as well as provide a way to get up to date quickly. Once that's fully fleshed out we'll look at other workflows that the compare tab can help out with.

  4. donokuda commented on Feb 8, 2018

    @donokuda
    Contributor

    Here's a design update on showing relationship between branches. The previous design back mostly focused around the scenario where you were behind a target branch. This next iteration of designs will support both scenarios where you're behind and ahead.

    We've replaced the "History" title with "Compare" to better represent the functionality of this view.

    The Default View

    image

    By default, when you're not comparing a branch, the compare view will show all the commits in your branch. This will be exactly like how the history view works currently.

    Branch selector

    NOTE: I'm currently exploring different ways of showing branch information in this view so this may change soon No longer exploring. This is what I've committed on:

    image

    When you start typing in the "Compare a branch..." text field, we'll drop down a list of branches to choose from. There will also be information around how many commits your branch has diverged from other branches.

    Compare View

    image

    Behind View

    The behind view shows the commits that are missing from your branch that exist in the target branch. This will help you understand what changes can be brought into your branch and give you the ability to stay up to date as you continue working.

    Just like the previous designs, you'll also be able to bring these changes into your branch using a merge button.

    Ahead View

    The ahead view shows all the commits that exist only in your branch and not the target branch. The commits in the list will be similar to the commits as if you were to open up a pull request.

  5. donokuda commented on Feb 8, 2018

    @donokuda
    Contributor

    Adding a couple questions I have off the top of my head:

    • Are the terms "Behind" and "Ahead" intuitive for those who aren't familiar with Git? Could we improve that?
    • There are people who found the comparison graph useful. I'd love more thoughts on how people integrate comparison graphs or git branch graphs in their workflows. I'm particularly interested with the problems people ran into and how the comparison graph was able to solve that.
  6. j-f1 commented on Feb 8, 2018

    @j-f1
    Contributor
  7. nerdneha commented on Feb 13, 2018

    @nerdneha
    ContributorAuthor

    By default, when you're not comparing a branch, the compare view will show all the commits in your branch. This will be exactly like how the history view works currently.

    @donokuda, if I understand correctly, the history view in the desktop app currently shows all of your commits in your branch + all commits from wherever you branched off of. The new one is showing all the commits in your branch only, yeah? this would be a slight change in behavior

  8. donokuda commented on Feb 13, 2018

    @donokuda
    Contributor

    The new one is showing all the commits in your branch only, yeah? this would be a slight change in behavior

    To clarify, the default view (i.e., no branch compared) is all of your commits in your branch + all commits from wherever you branched off of.

  9. changed the title [-]Relationship between branches "lite" tracking[/-] [+][Feature] Relationship between branches "lite" tracking[/+] on Feb 20, 2018
  10. shiftkey commented on Feb 21, 2018

    @shiftkey
    Member

    @nerdneha just FYI - I've made a minor change to the issue description to indicate when this can be used:

    When I create a new branch, I should be able to get a clear understanding of the commits I've made and how that compares to master or any other target branch.

    becomes

    When working on a local branch, I should be able to get a clear understanding of the commits I've made and how that compares to master or any other target branch.

  11. mathieudutour commented on Feb 24, 2018

    @mathieudutour
    Contributor

    If I can add something: when on a branch that is linked to a PR, I think the default state should be the comparison with the base of the PR

  12. changed the title [-][Feature] Relationship between branches "lite" tracking[/-] [+][Feature Tracker] Relationship between branches "lite" tracking[/+] on Mar 19, 2018
  13. changed the title [-][Feature Tracker] Relationship between branches "lite" tracking[/-] [+][Feature Tracker - RBB] Relationship between branches "lite" tracking[/+] on Mar 19, 2018
  14. changed the title [-][Feature Tracker - RBB] Relationship between branches "lite" tracking[/-] [+][Feature Tracker - RBB] Compare Branches Feature tracker[/+] on May 2, 2018
  15. added
    meta
    and removed on May 3, 2018
  16. iAmWillShepherd commented on May 3, 2018

    @iAmWillShepherd
    Contributor

    Closing this now that the compare branches feature is merged and available in the demo. All further tracking for releasing this is in #3955.

  17. JanderHungrige commented on Jun 18, 2018

    @JanderHungrige

    Hi, thanks for the great work.

    I have an additional idea for the "branch relationship visual overview". It could be nice if the visual overview would also be interative. E.g. right click on a commit to create a new branch from there. Maybe even a drag function where you can drag a commit back to the master branch. I remember when I first tried Github, this was the first thing I tried when searching for the "creating new branch function tab.

  18. locked as resolved and limited conversation to collaborators on Aug 17, 2018
  19. unlocked this conversation on Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    meta

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions