List all modified files in git merge commit - even the fast forwarded

前端 未结 3 1710
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-08 09:05

I\'m thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modifi

相关标签:
3条回答
  • 2020-12-08 09:45

    You can also use the diff command to see the difference between any two commits. If the branches haven't been merged yet, you can specify the branch names and compare them, otherwise you might need to find where they diverged (like so) an the last commit before they were merged back together.

    git diff --name-status <commit> <commit>
    

    -name-status Show only names and status of changed files. 

    0 讨论(0)
  • 2020-12-08 09:58

    suppose you have SHA of your merge commit, then git diff --name-only <SHA>^1 <SHA>

    0 讨论(0)
  • I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit:

    git log -m --name-only
    

    For only a list of filenames of the commit:

    git log -m -1 --name-only --pretty="format:" <Merge SHA>
    

    There is some white space due to the merge having two parents but that can be easily removed.

    0 讨论(0)
提交回复
热议问题