Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing which files have changed between two revisions

I want to merge two branches that have been separated for a while and wanted to know which files have been modified.

Came across this link: http://linux.yyz.us/git-howto.html which was quite useful.

The tools to compare branches I've come across are:

  • git diff master..branch
  • git log master..branch
  • git shortlog master..branch

Was wondering if there's something like "git status master..branch" to only see those files that are different between the two branches.

Without creating a new tool, I think this is the closest you can get to do that now (which of course will show repeats if a file was modified more than once):

  • git diff master..branch | grep "^diff"

Was wondering if there's something I missed...

like image 984
johannix Avatar asked May 05 '09 00:05

johannix


People also ask

How do I get a list of files changed in a commit?

Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.

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

To compare the current branch against main branch:

$ git diff --name-status main 

To compare any two branches:

$ git diff --name-status firstbranch..yourBranchName 

There is more options to git diff in the official documentation (and specifically --name-status option).

like image 74
JasonSmith Avatar answered Sep 23 '22 05:09

JasonSmith