开发者

How do I show the files that where merged with a no fast-forward in Git?

开发者 https://www.devze.com 2023-01-06 22:01 出处:网络
I have two branches, and I am mergin开发者_如何学Gog branch1 into branch2 with a no fast-forward.

I have two branches, and I am mergin开发者_如何学Gog branch1 into branch2 with a no fast-forward.

After the merge, I run the command 'git show', I only get the message that of the commit (which is the merge from the no fast-forward) and no list files that changed.

How do I get the list files changed in the merge?

SOLVED:

When at branch2 after the merge, I used the following:

git diff HEAD~

That returned the correct result.


Did you try with the git whatchanged command? (not tested):

git whatchanged --oneline

or

git whatchanged --oneline ..HEAD^
git whatchanged --oneline ..HEAD^2

--oneline

This is a shorthand for "--pretty=oneline --abbrev-commit" used together.

What I need is to see all the files that changed in branch1 that were merged to branch2.

branch2 may be represented here by HEAD^2, the second parent of HEAD.

As for "just the list of files":

git diff --name-status ..HEAD^2

should give you only a list of file with their associated status.


When at branch2 after the merge, I used the following:

git diff HEAD~

That returned the correct result.


After doing the merge, check the output of git reflog, which tracks where the tips of branches have been. The first line should be your merge commit, and the second should be where branch2 was before the merge. If that looks right, you can see from the second column of that output that the previous commit can be referred to as HEAD@{1}, so to see which files were changed by the merge, you could do:

git diff --stat HEAD@{1}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号