List of modified files in git after merge

Is there any way for a hook after a merge to get a list of all files that have been changed by the merge, even if it was fast forward?

+4
source share
2 answers

I think your best bet at this point is the loggies. If you just redirected, the first line of the HEAD reflog will look like this:

63e21fb HEAD@ {0}: merge origin/master: Fast-forward 

Thus, you should be able to print only the first line ( git reflog -n 1 ), check if it matches merge .*: Fast-forward$ , and if so, do git diff HEAD@ {1} HEAD . (You want to look at the locks to see if a quick merge is possible if you cannot be sure of your script that this is the only option now.)

+2
source

You can also use the ORIG_HEAD and HEAD shortcuts :

 git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD 

(see also: List of all files to commit in Git )

+7
source

Source: https://habr.com/ru/post/1338127/


All Articles