![](/img/trans.png)
[英]How can I create a sibling branch that includes all the commits from another branch into one node?
[英]How can I find all commits that are in one branch but not in another using git?
我有兩個分支, 主人和現場 。 法師是開發分支,並包含了不准備進入現場提交。
我希望能夠做的就是查看所有在主比不在現場的提交,我已經在這里和谷歌,我就是用這個一個很好的搜索:
git log --cherry-pick --no-merges --oneline master...live
這個工作,直到我住合並成高手 。 但現在它列出了兩個提交。
那么查看主分支中而不是實時分支中的所有提交的正確命令是什么?
你很近。 正確的命令是:
git log --cherry-pick --oneline --no-merges --left-only master...live
從日志手冊頁:
--left-only, --right-only
列表僅在對稱范圍的相應側提交,即僅標記為<resp。 > by --left-right。
例如,--cherry-pick -right-only A ... B省略那些來自B的提交,這些提交在A中或者是補丁相當於A中的提交。換句話說,這列出了來自git cherry的+提交A B.更確切地說,--cherry-pick --right-only --no-merges給出了確切的列表。
git log master ^live --no-merges
我最后使用結合了git patch-id和git log的簡短python腳本來解決我自己的問題,腳本可以在這里找到https://gist.github.com/4565584
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.