英文:
Git Show of a merge commit listing more files than the merged files
问题
我有3个特性分支和1个发布分支。我将来自Feature1的代码合并到Release,有2个提交。然后我正在将来自Feature2的代码合并到Release,有1个提交。当我执行git show命令来查看第2个合并提交时,它列出了所有文件,而不是仅显示Feature2合并的文件。
我希望我的合并提交ID只列出特定分支合并的文件,而不是显示所有文件。如果您不明白我的问题,请回复。
英文:
I have 3 Feature branches and 1 Release branch. I merged code from Feature1 to Release having 2 commits. Then i am merging code from feature2 to Release having 1 commit. When i execute the git show command with 2nd merge commit its listing all the files instead of showing only feature2 merged files.
git show -m -1 6929195e --name-only --stat --pretty=format:
I want my merge commit id to list only merged files from particular branch instead of showing all the files. Please reply if you dont understand my questions.
答案1
得分: 1
如果您只想列出已更改的文件,可以使用 git diff <SHA>^1 <SHA>
。
在您的情况下:
git diff --name-only 6929195e^1 6929195e
灵感来自于这篇文章。
英文:
If you want to list only changed files you could use git diff <SHA>^1 <SHA>
If your case:
git diff --name-only 6929195e^1 6929195e
Inspired by this article
答案2
得分: 1
如果您的最后提交是在将feature2
合并到master
之后生成的合并提交,那么您可以使用以下命令获取从feature2
合并的文件列表:
git show --first-parent <merge-commit-SHA> --name-only --pretty=format:
英文:
If your last commit is a merge commit generated after merging feature2
into master
, then you can use the following command to get the list of merged files from the feature2
:
git show --first-parent <merge-commit-SHA> --name-only --pretty=format:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论