我正在为开始在GIT中使用merge做一个小测试。引入合并的原因是由于开始与团队中的新开发人员合作。
我的分支:
开发(有一个文件:"created_in_develop_branch.txt)
)
我使用的GIT命令:
Step-1: [standing on feature/102-chat] merge develop
Step-2: Test and verify the merge.
Step-3: [standing on develop] merge feature/102-chat
我的理解是(在团队中工作)首先合并开发=>特性,测试合并结果,然后再合并特性=>开发,这是很好的实践。
当我做一个:站在功能/102-Chat合并开发,结果是分支" feature/102-chat“是它删除了"chat_new.txt”,并添加了"created_in_develop_branch.txt“。合并后两个文件不是都存在吗?
当试图在开发合并功能/102-Chat上进行合并时,这种行为是相同的。
以下是来自合并[Feature102-Chat => develop)的GIT响应:
trader@test:/repos/git/experiments$ git merge feature/102-chat
Updating f01887f..3fdef4d
Fast-forward
chat_new.txt | 1 +
created_in_develop_branch.txt | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
create mode 100644 chat_new.txt
delete mode 100644 created_in_develop_branch.txt
问题:为什么在功能/102-Chat中合并时删除开发分支中的文件?开发中的文件不应该保存吗?合并的结果是同时拥有开发和Feature102-Chat的文件吗?
发布于 2020-10-27 08:23:04
为了了解正在发生的事情,了解提交是如何在其中排序的通常是一件好事。
git的所有图形前端都提供历史查看器,
您还可以在使用git log
及其大量选项列表的终端中看到非常好的视图:
git log --oneline --graph
# you can view the combined history of any set of commits/branches :
git log --oneline --graph feature/102-chat develop master
在回购的历史上,您应该看到分支feature/102-chat
实际上已经在develop
之上了。以下信息也表明了这一点:
...
Fast-forward
...
在git merge
命令的输出中。
这意味着:从git
的角度来看,从develop
到feature/102-chat
的动作包括
添加文件chat_new.txt
created_in_develop_branch.txt
的
如果feature/102-chat
在develop
的历史上早些时候从develop
手中分叉,情况就不会如此。
https://stackoverflow.com/questions/64549584
复制相似问题