我使用git flow通过git flow feature start <feature name>
创建了两个分支。我不记得是否在这两个分支上都使用了git flow feature finish
,或者将分支A
合并到分支B
中并删除分支A
,然后从分支B
运行git flow feature finish
, 或者用git flow feature finish
将分支B
合并到develop
中,然后用git merge
将分支A
合并到develop
中,并解决合并冲突,最后用git branch -d <branch name>
删除分支A
。
使用git reflog
,我能找到分支A
的最后一次记录是在序列中的e553bf0
:
e553bf0 HEAD@{40}: checkout: moving from feature/a to develop
6b30050 HEAD@{41}: checkout: moving from develop to feature/a
e553bf0 HEAD@{42}: checkout: moving from feature/a to develop
6b30050 HEAD@{43}: checkout: moving from develop to feature/a
e553bf0 HEAD@{44}: commit (merge): resolved merge conflicts
7a0ad6b HEAD@{45}: checkout: moving from feature/a to develop
6b30050 HEAD@{46}: checkout: moving from develop to feature/a
7a0ad6b HEAD@{47}: merge feature/b: Merge made by the 'recursive' strategy.
921ae46 HEAD@{48}: checkout: moving from feature/b to develop
此外,git log
显示
commit e553bf07272ab2b1975917b736b37127636c0db1
Merge: 7a0ad6b 6b30050
Author: Eric Baldwin <address-here>
Date: Thu Jul 25 14:58:49 2013 -0400
resolved merge conflicts
commit 7a0ad6b2277c0c0a7599193829f68517ac708ca2
Merge: 921ae46 02558b6
Author: Eric Baldwin <address-here>
Date: Thu Jul 25 14:03:56 2013 -0400
Merge branch 'feature/b' into develop
两个功能的代码目前都在 develop
分支,但我不知道合并的顺序。能否有人根据历史记录告诉我这三种情况中发生了哪一种?
编辑:
git log --oneline --graph develop
命令的输出:
* 2ebb938 misc
* 69f95f6 Merge 'feature/x' into 'develop' merge conflicts
|\
| * 8b9b275 Merge 'develop' with feature/x; minor merge tweaks
| * eb89630 misc
| * 54884d2 misc
| * 76f02bb Merge branch 'develop' into feature/x
| |\
| * | d06d673 misc
| * | 0ba5235 misc
* | | 5489590 misc
* | | a215bd2 misc
* | | 4aacaa7 misc
* | | e553bf0 resolved merge conflicts
|\ \ \
| * | | 6b30050 fixed test db error
| * | | 64909f9 Merge branch 'develop' into feature/a
| |\ \ \
| * \ \ \ e7319e1 Merge branch 'develop' into feature/a
| |\ \ \ \
| * | | | | 410786b misc
| * | | | | 67267f3 misc
| * | | | | ae4b800 misc
| * | | | | 9e281eb Merge branch 'develop' into feature/a
| |\ \ \ \ \
| * | | | | | f8fa2ec misc
* | | | | | | 7a0ad6b Merge branch 'feature/b
|\ \ \ \ \ \ \
| * | | | | | | 02558b6 ready to merge
| * | | | | | | cc07f79 Merge branch 'develop' into feature/b
| |\ \ \ \ \ \ \
| | | |_|_|/ / /
| | |/| | | | |
| * | | | | | | 4b6610f misc
| * | | | | | | 25e509b Merge branch 'develop' into feature/b
| |\ \ \ \ \ \ \
| | | |_|_|/ / /
| | |/| | | | |
| * | | | | | | df5640d merged with develop
git log --oneline --graph develop
的输出结果?另外,根据你的 reflog,6b30050
是feature/a
所在的位置,而e553bf0
是develop
上的一个提交。你可以通过运行git log --oneline --graph <sha>
来查看它们的历史记录。此外,显然你已经做了很多功课,并提供了大量有用的信息来帮助解决问题,点个赞! - user456814git log --oneline --graph develop
的输出。 - Eric Baldwinreflog
和第一个log
都说你在7a0ad6b
将B
合并到了develop
,但是你添加的第二个log
说你在7a0ad6b
将A
合并到了develop
。请修正并更新你的问题。 - user456814