Git :列出 git 中所有未合并的更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3600728/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 08:59:04  来源:igfitidea点击:

Git : List all unmerged changes in git

gitbranch

提问by Lakshman Prasad

Creating a branch for various topics, and not regularly deleting them when I don't need them any more, I have now ended up with about 50 branches ;)

为各种主题创建一个分支,当我不再需要它们时不定期删除它们,我现在已经有大约 50 个分支;)

I tried deleting branches and some of them have unmerged changes.

我尝试删除分支,其中一些分支有未合并的更改。

What I want is the ability to see exactly what changes are there in any branch on my repo that are not in the master. Is there a way to do that

我想要的是能够准确查看我的 repo 上的任何分支中有哪些不在 master 中的更改。有没有办法做到这一点

Thanks in advance.

提前致谢。

回答by gawi

To list branches with commits not merged into master:

要列出未合并到 master 的提交的分支:

git branch --no-merged master

To list the relevant commits:

列出相关提交:

git cherry -v master <branch>

回答by Matt

I came across this question when I was trying to remember the syntax of...

当我试图记住...的语法时遇到了这个问题。

git log <branch> --not master --stat

This will show commits to <branch> that have not been merged to master. The --stat will include the files that were changed with the commits. You can also use this to compare any two branches by replacing master with a different branch name.

这将显示尚未合并到 master 的对 <branch> 的提交。--stat 将包含随提交更改的文件。您还可以使用它来比较任意两个分支,方法是将 master 替换为不同的分支名称。

回答by tamasd

It is quite easy to get an overview of your branches with gitk.

使用gitk.