How to check changes made from an old git branch that has been merged

Advertisements

help needed here.. does anyone know how to check the changes of an old git branch that has been merged?

Asking this because i want to learn from previously merged branch by others.

I switched to the old branch and did a git diff HEAD^ HEAD
and there was no result.

>Solution :

As explained by you we assume we have a feature branch A and a main branch B.

In the actions provided by you, I merged A into B.
Post the above merge as you pointed out ( git diff HEAD^ HEAD) you are seeing the result as "no result" which is the ideal behavior.

Reson being all the changes that were there in branch A is now part of branch B hence the message.

to confirm this you can make some changes in Branch A -> commit the changes and now try comparing both the branches. this will result in displaying the diff produced by the commit.

If in case you want to learn the changes which were there in the previous branch you need to refer to the command called git log, which solves the exact issue you are facing.

More about git log:
https://git-scm.com/docs/git-log

This will answer your queries. Hope this helps, Thanks.

Leave a ReplyCancel reply