如何找出git分支中更改了哪些文件(不是两个分支之间的差异) [英] How to find out what files were changed in a git branch (not the difference between two branches)

查看:338
本文介绍了如何找出git分支中更改了哪些文件(不是两个分支之间的差异)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为feature_219的分支,它是在不久前从master创建的.自转移以来,两个分支上都更改了许多文件.

I have a branch named feature_219 which was created from master a little while ago. Since the diversion, there were a number of files changed on both the branches.

现在,我试图找出仅在feature_219分支上工作时更改了哪些文件.

Now I am trying to figure out what files where changed while working on the feature_219 branch only.

经过研究后,我发现git diff --name-only master feature_219可能有所帮助,但事实证明,该命令可以告知两个分支中所有不同的文件.我试图用此命令寻找一些选项,但对我没有任何帮助.

After doing some research I found out that git diff --name-only master feature_219 might help but it turned out that this commands tells about all files that are different in both the branches. I tried to look for some option with this command but nothing worked for me.

有什么办法只列出那些在feature_219分支中更改过的文件?

Is there any way to list only those files that were changed in feature_219 branch?

推荐答案

您可以使用git merge-base查找两个分支的共同祖先,然后求出差异.

You could use git merge-base to find a common ancestor of two branches, then get the diff.

git diff --name-only feature_219 $(git merge-base master feature_219)

这篇关于如何找出git分支中更改了哪些文件(不是两个分支之间的差异)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆