我正在寻找p4 interchanges相当于 git 中的内容。是否有任何选项/标志可以查找一个分支中尚未集成/merge 到另一个分支的更改。
我正在寻找此选项来跟踪在我的功能分支中完成的更改是否尚未 merge 到主分支中,然后才能剪切发布分支。
最佳答案
使用 git cherry
怎么样?
git cherry [-v] [<upstream> [<head> [<limit>]]]
- outputs the SHA1 of every commit between
<limit>
and<head>
,- and prefixes a
-
to commits in the list that have an equivalent in<upstream>
- and prefixes a
+
to commits in the list that do not have an equivalent in<upstream>
其中 <upstream>
和 <head>
引用 git 分支
<limit>
指的是 git 存储库历史记录中的一次提交。
在 topic
分支包含三个提交的情况下,
并且维护者将其中两个应用到 origin/master
,情况可能如下所示:
$ git log --graph --oneline --decorate --boundary origin/master...topic
* 7654321 (origin/master) upstream tip commit
|
* cccc111 cherry-pick of C
* aaaa111 cherry-pick of A
|
| * cccc000 (topic) commit C
| * bbbb000 commit B
| * aaaa000 commit A
|/
o 1234567 branch point
现在 git-cherry
将显示尚未应用于 origin/master
的内容的简明摘要:
$ git cherry origin/master topic
- cccc000... commit C
+ bbbb000... commit B
- aaaa000... commit A
在这里,我们看到提交 A
和 C
(用 -
标记)已经被挑选到 origin/master
中,而提交 B
(用 +
标记) ) 尚未 merge 到 origin/master
中。
When we have 2 local branches X and Y to be compared;
To ask the question:
Are there any commits in branch X that are NOT yet in branch Y?we would say
git cherry branchY branchX
and look for any commits listed with a+
before them.
关于git - Perforce p4 相当于 git 中的交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35051431/