Skip to content

Easy way to compare HEAD and MERGE_HEAD when branch is in merging state #1145

@rafaelfassi

Description

@rafaelfassi

When solving merging conflicts, in many cases the merged file with the conflict's tags generated by git don't provide all needed information to solve the conflict, and we need to take a look in the HEAD against the MERGE_HEAD to be able to solve the conflict properly.
Let't me provide a very little tiny example as follow:

Base -----------------------

void main ()
{
    int var;

    var = 10;
}

Then someone and myself clone the branch, and the other guy commits and push first.

Others -----------------------

void main ()
{
    int other;

    int other = 10;
}

Mine -----------------------

void main ()
{
    int var;

    fillVar(var);
}

When I merge, I'll get this result:

void main()
{
    int other;

<<<<<<< HEAD
    fillVar(var);
=======
    int other = 10;
>>>>>>> origin/master
}

Now, how would I know what happens with the variable var without a diff between my HEAD and the incoming (MERGE_HEAD)?

Please, notice that it may happens even without conflicts, and for that reason I always merge with the parameter --no-commit, so that, I have the opportunity to review the changes.

In both cases (having conflicts or not) my branch will be in merge state, where besides of HEAD it'll also have the MERGE_HEAD that points to the HEAD of the incoming commit.

Currently, to be able to compare HEAD and MERGE_HEAD I need to ask GitLens to compare my branch at head with the other branch that I'm merging, and then trying to find the files that I want to compare (among lots of files and folders...).
Okay, it's not that so hard, but would be much more easy if GitLens could detect Merging state and give me an option to compare HEAD against MERGE_HEAD 😀

I was thinking about some new option appearing here when in merging state.
image
But that is up to you 😃

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions