Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Evaluating a Git merge

Options
  • 27-01-2017 6:14pm
    #1
    Registered Users Posts: 8,197 ✭✭✭


    I've been asked to check if a merge was done correctly.
    Is there a way to do this other than manually going through the diff output which is quite big?

    Thanks.


Comments

  • Registered Users Posts: 8,197 ✭✭✭funkey_monkey


    Figured out a way of checking it.

    Resolved.


  • Registered Users Posts: 6,252 ✭✭✭Buford T Justice


    Figured out a way of checking it.

    Resolved.

    Can you post the solution so it might help others?


  • Registered Users Posts: 8,197 ✭✭✭funkey_monkey


    I was asked to ensure that no additional changes were made by a user when they merged their local branch into the main branch. I'm sure there are better and/or more efficient ways of doing this, but below is what I done.


    I used (from memory):

    git log --grep <SEARCH TEXT>

    The search text for me was the problem reference (development task) under which the user made their updates. This brought up the commit(s) I was interested in. I needed to see what updates the user made - this was repeated a few times for various commits.

    git diff commit_ref^ commit_ref

    The ^ character refers to the commit previous to the comm_ref.

    This allowwed me to build up a picture of all the changes made by the user.

    When it was merged into the mainline branch I then was able to diff the commit and the previous commit to see the differences and was able to cross reference them to see that only the changes made in the local branch were merged into the mainline branch.


    If anyone has a better way of doing it please share. I'm new to using git.


    Where my initial checks went wrong was that I was diffing the merge commit with the previous local commit. This meant it was showing up all commits made by previous users.

    So essentially I done checks on the local branch to see what changed and then checked the merged commit with the previous mainline commit and was then able to perform the manual comparison to see if it was correctly merged.

    That is what I done. Whether it is the correct thing to do I don't know. Hopefully the more experienced on here can show a more efficient way of working it out.



    Thanks.


Advertisement