我一直在研究分支align
,想从中挑选一些提交到master
. 我git cherry
用来寻找候选提交:
C:\Users\me\Documents\repo>git cherry -v master align | head -1
+ c2bbb3d99440be7524673702c92ad65e6522d2b1 Made RW_assert() work on 64-bit.
我的理解是 '+' 表示在master
. 但我记得已经挑选了这个承诺master
。事实上,这是rw-fwd.h
对分支文件的最新更改align
:
C:\Users\me\Documents\repo>git log align -1 rw-fwd.h
commit c2bbb3d99440be7524673702c92ad65e6522d2b1
Author: Me
Date: Thu Jun 8 10:41:01 2017 +1000
Made RW_assert() work on 64-bit.
并且仍然是分支上 rw-fwd.h 的最新更改master
:
C:\Users\me\Documents\repo>git log master -1 rw-fwd.h
commit 5bc790b9b0adfcdc6c0a07b679155e33974e343a
Author: Me
Date: Thu Jun 8 10:41:01 2017 +1000
Made RW_assert() work on 64-bit.
状态文档git cherry
:“等效测试基于差异,在删除空格和行号之后。git-cherry 因此检测提交何时通过 git-cherry-pick[1]、git-am[ 1] 或 git-rebase [1]。” 从视觉上看,使用git show
,提交看起来是一样的,但让我们绝对确定:
C:\Users\me\Documents\repo>git show c2bbb3d | git patch-id
f6ad0912fd71f694b6b00c6ea93c87af7cf4ab98 c2bbb3d99440be7524673702c92ad65e6522d2b1
C:\Users\me\Documents\repo>git show 5bc790b | git patch-id
f6ad0912fd71f694b6b00c6ea93c87af7cf4ab98 5bc790b9b0adfcdc6c0a07b679155e33974e343a
补丁 ID 是相同的。为什么git cherry
没有检测到这个提交已经被挑选出来了?
编辑:下面是经过消毒的git log --oneline --decorate --graph。 我添加这个是为了回应@torek 的答案,不是因为我怀疑答案是否正确,而是因为我会根据该答案在解释真正的提交日志方面提供一些帮助。
master
位于 a52f43e(第一行)和align
9ffa94e(第三行)。
align
是图上最右边的线,一直向下,并且不合并。
* a52f43e ######## ############ #####
* 507e731 ##### ##### ### ## ###
| * 9ffa94e (origin/align) Merge branch 'master' of https://ghe/repo/repo into align
| |\
| |/
|/|
* | 657d6c8 Merge pull request #8 from repo/test_system
|\ \
| * \ 679739b Merged origin master into local branch.
| |\ \
| |/ /
|/| |
* | | c7a5944 Merge branch 'master' of https://ghe/repo/repo
|\ \ \
| * \ \ e12016c Merge pull request #7 from repo/lean-mean
| |\ \ \
| | * | | 144fefd ##### ####### ##### ## #######
| | * | | 87e0e23 ####### ############## ## ####### ####### ...
| * | | | 8613f4e ######## ####### ######### ## ###### #####...
| |/ / /
* | | | 8f70a8d ######### #### ##### ### ###### ### ########...
* | | | aedb306 Merge branch 'master' of https://ghe/repo/repo
|\ \ \ \
* \ \ \ \ 0a4fd59 Merge branch 'master' of https://ghe/repo/repo
|\ \ \ \ \
* \ \ \ \ \ e1cfbfd Merge branch 'PBA_Experiment' of https://ghe/repo/repo
|\ \ \ \ \ \
| * | | | | | 7f1bc5b (######/##############) ##########
| | | | | * | 323d965 ######## ######### ####### ########.##...
| | | | | * | 5839749 ##### #######-#### ###### ## ### ## ##...
| | | | | | * d96ba71 ##-####### ############, ## ##### ####...
| | | | | | * 680354b #### ##### ######### #####, ##-###### ...
| | | | | | * a066e66 #####. ### ### ###### ########## ####...
| | | | | | * afb7945 (###: ####-##-##-#######, ###: ####-##...
| | | | | | * a14e769 Merge remote-tracking branch 'origin/master' into align
| | | | | | |\
| | | | | |_|/
| | | | |/| |
| | | | * | | 4354de6 Merge pull request #5 from repo/tech-bug-fixes
| | | | |\ \ \
| | | | | * | | c084aa8 (######/####-###-#####) ##### ######...
| | | | | * | | aea8a4f ######### ###-######## # ###### ### ...
| | | | | * | | 7857c95 ### #### #############, ### ### ####...
| | | |_|/ / /
| | |/| | | |
| | | | * | | 0b65102 .
| | | | * | | 2448af9 Merge branch 'master' of https://ghe/repo/repo
| | | | |\ \ \
| | | | * | | | 04c03da ##### ##### ###### ## ###### #######...
| | | | | | | * e05b167 ###### ### ## ######### ##########, ...
| | | | | | | * c3422d5 ##### ###############() ###### ## ##...
| | | | | | | * 92f4eff ##### ### ## ######/######### ####-#...
| | | | | | | * 35fb291 ### ################## (##### ######...
| | | | | | | * 6d12b2c ##### # ####### ## ######### #-###-#...
| | | | | | | * aa84d37 Merge branch 'master' into align
| | | | | | | |\
| | | | | | |_|/
| | | | | |/| |
| | | | | * | | a96cb9d ##### #### ##### ######## ### ##### ...
| | | | |/ / /
| | | | * | | 911e5d2 ######## ### ##### #########.
| | | |/ / /
| | | * | | d32ef9a Merge pull request #4 from repo/tech
| | | |\ \ \
| | |/ / / /
| | | * | | 092858f (######/####) ######## #### ## ######.
| | | * | | 1d862dd ##### ############ ## #### ### ### #### ...
| | | * | | 7eae069 Merge branch 'master' into tech
| | | |\ \ \
| | | |/ / /
| | |/| | |
| | | * | | f639a00 ##### ##### ## ### ########
| | | * | | ac794d9 ##### ################ ###### #### #####...
| | | * | | b0296ac ####### ########## ## ####### #### ## ##...
| | | * | | 91f2adf ###########
| | | * | | 47ae5eb ######
| | | * | | a975c46 ####### ##### ## #########
| | | * | | 041a552 Merge branch 'tech' of https://ghe/repo/repo into tech
| | | |\ \ \
| | | | * | | 908b8f7 ######
| | | | * | | 85ff704 Merge branch 'tech' of https://ghe/repo/repo into tech
| | | | |\ \ \
| | | | * | | | 6351c83 ######
| | | * | | | | 1486296 ###### #### ########.
| | | | |/ / /
| | | |/| | |
| | | * | | | 89cefd9 ######### ############# #### ### #####...
| | | |/ / /
| | | * | | 401b346 ### ########## ## ######### ######### ##...
| | | * | | 0e36458 Merge branch 'tech' of https://ghe/repo/repo into tech
| | | |\ \ \
| | | | * | | 7029347 ######
| | | | * | | d819996 Merge branch 'tech' of https://ghe/repo/repo into tech
| | | | |\ \ \
| | | | * | | | 1d11d8a ######
| | | | * | | | 0f52244 Merge branch 'tech' of https://ghe/repo/repo into tech
| | | | |\ \ \ \
| | | | * | | | | 63f49c3 ######
| | | * | | | | | 15e0017 ######
| | | | |_|/ / /
| | | |/| | | |
| | | * | | | | a7c00b8 ######### ## ### #### ### #### ####
| | | | |/ / /
| | | |/| | |
| | | * | | | 5074fe5 ####### ## #### ########## ###### ## #...
| | | |/ / /
| | | * | | 989e68c ####### ## ### #### ### #### #### ####, ...
| | | * | | 9b3545c Merge branch 'tech' of https://ghe/repo/repo into tech
| | | |\ \ \
| | | | * | | 2a9f6b2 ##### #### ## ######## ######### #####...
| | | * | | | 519ac87 ######
| | | |/ / /
| | | * | | e850bac ######
| | | * | | 7e920c4 ######### ## ### #### ### ####### ### ##...
| | | * | | ac4608d ######## ## #### #### ########### ## ###...
| | | * | | f7f4e0c ###### ##-######### ## ###### ## ## ####...
| | | * | | 7ed258f ##### ######## ## ###### ##### ##### ###...
| | | | | * 67c8f71 ##### ### ## ######### ######## ########...
| | | | | * 2280a88 ##### ######### ### #### ### ##########
| | | | | * 3bd5b85 ##### # ### ## ##-######; ## ##### #####...
| | | | | * 7919cc3 Merge branch 'master' into align
| | | | | |\
| | | |_|_|/
| | |/| | |
| | * | | | 7278053 ##### #### ####### ##########.
| |/ / / /
|/| | | |
| | | | * 31d1e44 ##### # ### ### ### ######### ## ###### ##...
| | | | * 87f8195 ######## ### ### ###### ##### ####### ####...
| | | | * 379bd4a ### '#' ### ## #### # #### ### ####### ###...
| | | | * fe30105 ##### ######### ###### ##### ## ###### ###...
| | | | * 3b50f20 Merge branch 'master' of https://ghe/repo/repo into align
| | | | |\
| |_|_|_|/
|/| | | |
* | | | | 48ca2d6 Merge branch 'master' of https://ghe/repo/repo
|\ \ \ \ \
| |/ / / /
| * | | | edbf46e Merged from align
| |\ \ \ \
| * | | | | af282b8 ##### ###### ### ######### ### ## .#####...
| * | | | | 2237855 ####### ### ######### ### #### ##### ## ...
| * | | | | f0711d9 ##### ###################() ### ########...
| * | | | | 5bc790b Made RW_assert() work on 64-bit.
* | | | | | c53aad5 ##### ######## ### ######## ####### ### ...
* | | | | | 1b4f135 ##### ####### #### #### ### ######-#####...
| | | | | * 49730f3 #####, ### ######, ## ###### ######## ##...
| | | | | * 8efc11e ##### ###### ### ######### ### ## .#####...
| | | | | * e0f583a ####### ### ######### ### #### ##### ## ...
| | | | | * 3b1a263 ##### ###################() ### ########...
| | | | | * c2bbb3d Made RW_assert() work on 64-bit.
| | | |_|/
| | |/| |
| | * | | 67154d6 ##### ##### ####### ### ####. ######### ##...
查看上面日志的底部,c2bbb3d 是对 的初始提交align
,5bc790b 是对master
. 67154d6 我期望是共同的祖先,那是输出git cherry
停止的地方。
我仍然无法回答的问题是,我怎样才能获得align
尚未提交的提交列表master
?似乎任何从 可到达align
但不是从的提交master
都是候选者,只要它还没有被挑选到master
。任何馈入的分支master
都必须检查樱桃挑选 - 包括图中除了最右边的每个分支,align
.
注意:我们已经使用 git 几个月了,所以我很确定我们正在做的大部分事情都不是最佳实践。我们从反复试验中学到了很多东西。