Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences for a certain folder between git branches [duplicate]

People also ask

How can you find out the differences between the files in two different branches?

In order to see the commit differences between two branches, use the “git log” command and specify the branches that you want to compare. Note that this command won't show you the actual file differences between the two branches but only the commits.

How do I compare the differences between two branches in GitHub?

On the Github, go to the Source view of your project. You will see a link named 'Branch List'. Once the page opens you can see a list of all the remote branches. Hit on the Compare button in front of any of the available branches to see the difference between two branches.


You can use

git diff master..yourbranch path/to/folder

git diff compares trees (as in hierarchies of source files at two different points in time), so it can't extract the changes done by a certain author. If you want to see what changes a user committed, then you need git log.

Does this solve your need?

git log --author=jdoe oldbranch..newbranch -p -- path/to/subdirectory > myChangesInSubdirectory.patch

This lists each commit done by jdoe between the two commits, printing them as a patch instead of the usual commit summary, limiting only to commits that have changes in the target subdirectory, and redirects the output to a file.