2
 f1---f2 - short term branch "feature1" / \ h--h--h---h--h1--h2- - long term branch "hofix" / \ \ \ / \ \ \ m----m------m---m------m-- - long term branch "master" | | 1e1e1e 2f2f2f 

I merge branches with 2 commits difference (15 file changed totaly). And ran:

$ git show --pretty="format:" --name-only 1e1e1e..2f2f2f 

I receive more than 42 000 file changed from my project. Why?

Expected: i will show diff with f1,f2,h1,h2 commits

P.S. May be because "Merge branch 'origin/0411-hotfix'" commit?

2
  • What does git merge-base 1e1e1e 2f2f2f returns? Which 'h'? Commented Nov 22, 2013 at 9:56
  • this rarely happens, in 1 from 5 case. I can not catch it. Commented Nov 24, 2013 at 13:32

1 Answer 1

5

1e1e1e..2f2f2f means:

  • all commits that are reachable from 2f2f2f
  • excluding those that are reachable from 1e1e1e

(See "SPECIFYING RANGE" from gitrevisions)

If those SHA1s reference the two commits merged, you have:

 1e1e1e | x--x--x \ Z / y--y--y | 2f2f2f 

That would give you all the files from all 'y' commits, which can potentially go as far as the very first commit, and that means you get all the files.

However, since git diff doesn't take a range of commits (as opposed to git show), you can try, as in "How to “git show” a merge commit with combined diff output":

git diff --name-only 1e1e1e..2f2f2f 

Or simply use the merge SHA1 'Z', as in "List all modified files in git merge commit - even the fast forwarded":

git log -m -1 --name-only --pretty="format:" <Merge SHA> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.