Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in DevOps and Agile by (19.4k points)
edited by

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...

1 Answer

+1 vote
by (27.5k points)
edited by

Use the following compare the current branch against master branch:

$ git diff --name-status master

Use the following to compare any two branches:

$ git diff --name-status BranchA..BranchB

For more information please go through the following tutorial to get more info about git:

 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...