views:

3645

answers:

2

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

+2  A: 

Note that git makes it easy to just try out the merge and back away from any problems if you don't like the result. It might be easier than looking for potential problems in advance.

David Plumpton
David, that's a good point, although it'd be nice to just know what's going on before hand...
+29  A: 

Try

$ git diff --name-status master..branch

That should do what you need, if I understand you correctly.

jhs
Beautiful, exactly what I was looking for. Thanks!
+1, sometimes --name-only is handy too
Pat Notz
I'm glad to help!
jhs
That's pretty kool! I needed it too! Thanks
hasen j