Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git see entire merge diff

Tags:

git

I want to be able to see the entire patch applied by a merge as a single diff output. In bzr this is the standard (such that if you view the diff at a merge point you get the entire diff resulting from that merge). In git I don't see how to get this unified view of the merge. Using gitk I have to click on each individual commit in the branch. I want to see the entire branch as a single commit.

I know that I can simply manually find the branch point and do a diff between two points, but this is error prone. How can I see the entire diff for a merge?

like image 352
edA-qa mort-ora-y Avatar asked Jan 27 '12 08:01

edA-qa mort-ora-y


People also ask

How do I see all git diff?

The diff can be done with git diff (followed by the filename or nothing if you want to see the diff of all modified files). But if you already did something like git add * , you have to undo with git restore --staged .

How do I see changes in a merge commit?

It shows all the changes made to the merged branch as a result of the merge. Show activity on this post. git show -c c0f501 will display a combined diff from commit c0f501 to both of its parents, as printed by git diff during a merge. This gives a better overview than git show -m .

What is the command to check diff in git?

You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.

How do you find the difference between two commits?

To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..


1 Answers

Lets say your merge has the hash "1234abc". What you can do is to run:

git diff 1234abc^1 1234abc

Pretty much displays a "before" "after" comparison.

like image 161
pagid Avatar answered Sep 25 '22 20:09

pagid