显示哪些文件在两个修订版之间发生了变化 [英] Showing which files have changed between two revisions
问题描述
想合并两个分开一段时间的分支,想知道修改了哪些文件.
I want to merge two branches that have been separated for a while and wanted to know which files have been modified.
发现这个链接:http://linux.yyz.us/git-howto.html 很有用.
Came across this link: http://linux.yyz.us/git-howto.html which was quite useful.
我遇到的比较分支的工具是:
The tools to compare branches I've come across are:
git diff master..branch
git log master..branch
git shortlog master..branch
想知道是否有类似git status master..branch"之类的东西?仅查看两个分支之间不同的文件.
Was wondering if there's something like "git status master..branch" to only see those files that are different between the two branches.
如果不创建新工具,我认为这是您现在最接近的方法(如果文件被多次修改,当然会显示重复):
Without creating a new tool, I think this is the closest you can get to do that now (which of course will show repeats if a file was modified more than once):
git diff master..branch |grep^差异"
想知道我是否遗漏了什么......
Was wondering if there's something I missed...
推荐答案
将当前分支与 main
分支进行比较:
To compare the current branch against main
branch:
$ git diff --name-status main
比较任意两个分支:
$ git diff --name-status firstbranch..yourBranchName
官方文档中有更多关于git diff
的选项a>(特别是 --name-status
选项).
There is more options to git diff
in the official documentation (and specifically --name-status
option).
这篇关于显示哪些文件在两个修订版之间发生了变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!