Git merge -no-ff 转移提交历史,但不转移内容
Git merge -no-ff transferred commit history, but not content
在 GitLab 中遇到了一个错误。我的一个项目有 50 多个模块。所以当我合并分支时,我使用 bash 脚本,而不是使用 GitLab 合并 UI。到目前为止,这工作得很好。这次我遇到了一个奇怪的问题。合并提交将提交历史从源分支转移到目标分支,但不转移源分支的内容。我试图将分支 cr_integrate 合并到分支 cr_release。在本地,我已经 cr_release 退房了。
我用于合并的脚本如下:
git pull
git merge --no-ff origin/cr_integrate -s ours
git add *
git commit -m "Integrate merged into Release by script"
git push
项目包含子模块,.gitmodules文件的内容对于不同的分支是不同的,因此我使用了-s ours以避免冲突。脚本有问题还是 GitLab 有问题?
hence I used -s ours
to avoid conflict
但是-s ours
不是冲突解决策略。这是一种合并策略。
我喜欢阅读文档:
the ours
merge strategy ... does not even look at what the other tree contains at all. It discards everything the other tree did, declaring our history contains all that happened in it.
[强调我的]
所以,现在,你说:
The merge commit transferred the commit history from the source branch to the target branch, but not the content of the source branch.
是的。因为那是你说要做的。也许你的意思是 -s recursive -X ours
?这是一种解决冲突的策略。
在 GitLab 中遇到了一个错误。我的一个项目有 50 多个模块。所以当我合并分支时,我使用 bash 脚本,而不是使用 GitLab 合并 UI。到目前为止,这工作得很好。这次我遇到了一个奇怪的问题。合并提交将提交历史从源分支转移到目标分支,但不转移源分支的内容。我试图将分支 cr_integrate 合并到分支 cr_release。在本地,我已经 cr_release 退房了。
我用于合并的脚本如下:
git pull
git merge --no-ff origin/cr_integrate -s ours
git add *
git commit -m "Integrate merged into Release by script"
git push
项目包含子模块,.gitmodules文件的内容对于不同的分支是不同的,因此我使用了-s ours以避免冲突。脚本有问题还是 GitLab 有问题?
hence I used
-s ours
to avoid conflict
但是-s ours
不是冲突解决策略。这是一种合并策略。
我喜欢阅读文档:
the
ours
merge strategy ... does not even look at what the other tree contains at all. It discards everything the other tree did, declaring our history contains all that happened in it.
[强调我的]
所以,现在,你说:
The merge commit transferred the commit history from the source branch to the target branch, but not the content of the source branch.
是的。因为那是你说要做的。也许你的意思是 -s recursive -X ours
?这是一种解决冲突的策略。