0

I have a master, branch1, and branch2.

I have used 'git merge' then 'git mergetool' to merge deltas (i.e. changes between master and branch2) into branch1.

Now I would like to identify all modified files under branch1 as the result of the above merge and copy all those modified files into a separate folder to send to someone.

What is the right way to do that?

Thanks! p/s: my apology if this is too trivial question, I am new to GIT

CG Nguyen
  • 97
  • 6

1 Answers1

0

You can try :

git diff --name-only branch1^ branch1
# or :
git diff --name-status branch1^ branch1

Explaining :

  1. In general, git diff [commit1] [commit2] will work with any two commits :

    git diff branch1 master
    git diff tag/v1.0 branch2
    git diff eacf32bb8 branch1
    # etc ...
    
  2. With the --name-only or --name-status option, git diff will only display the list of modified files between the two commits (with --name-status, it will add a letter A, M or D in front of the filename, to indicate if it was Added, Modified or Deleted)

  3. When dealing with a merge commit, it has two parents :

    ...*--*--*--*--A---M  <- branch1
           \          /
            *--*--*--B
    

    in the sketch above, A is the first parent of M, and B its second parent.
    branch1^ designates A (the first parent of branch1), branch1^2 would designate B (the second parent of branch1).

LeGEC
  • 46,477
  • 5
  • 57
  • 104