简体   繁体   English

列出比我的登台分支新的分支(来自所有分支,包括获取的远程分支)的所有新提交?

[英]List all new commits based on the tip of my branch (from all branches including fetched remote ones) that are newer than my staging branch?

I'm looking for exact command to list all the commits from all existing branches that are not merged into my branch (including from remote branches that was fetched) that are based on the tip of my staging branch. 我正在寻找确切的命令,以基于暂存分支的提示,列出所有未合并到我的分支中的现有分支(包括从获取的远程分支中)的所有提交。

git log --all --remotes I use this to list all of the branches. git log --all --remotes我用它列出所有分支。

How do I exclude the once that I already have in the staging branch? 如何排除登台分支中已经存在的一次?

Use git log --branches --remotes ^staging , or equivalently, git log ^staging --branches --remotes . 使用git log --branches --remotes ^staging ,或等效地,使用git log ^staging --branches --remotes

You can use --all if you mean all references (including tags, notes, refs/stash , etc), but you specifically said branches and remote-tracking names, for which --branches and --remotes produce the correct match. 如果要表示所有引用 (包括标签,注释, refs/stash等),则可以使用--all ,但是您专门说了--branches--remotes产生正确匹配项的分支和远程跟踪名称。 Note that --branches and --remotes may be followed by =<pattern> to match specific name patterns. 请注意,-- --branches--remotes可以带有=<pattern>以匹配特定的名称模式。

The trick here is that the negation syntax ( ^X , or --not followed by X ) tells the revision-walk code to exclude the commit named X and any commit reachable from X . 这里的技巧是,否定语法( ^X--not后跟X )告诉修订版本代码排除名为X的提交以及从X可以到达的任何提交。 Positive references give git log places to start; 正引用给出了git log 开始的位置; negative references give git log places to stop; 否定引用给git log 停止位置; and git log then loops over a priority queue that contains commits that are yet to be visited. 然后git log遍历优先级队列,该队列包含尚未被访问的提交。 So, initially, the queue looks at (contains hash IDs of) all branch tips and all remote-tracking-name tips, in some order. 因此,最初,队列以某种顺序查看所有分支提示和所有远程跟踪名称提示(包含其哈希ID)。 Git visits the first such commit, unless it's excluded, ie, is at the tip of staging or reachable from the tip of staging . 除非被排除,否则Git会访问第一个此类提交,除非它处于staging的顶端或从staging的顶端可以到达。 Git puts that commit's parent into the queue, then visits the next commit in the queue (unless it's excluded, as before). Git将该提交的父级放入队列,然后访问队列中的下一个提交(除非像以前一样被排除在外)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM