当我没有进行任何 merge 时,为什么这些 merge 说“从开发到开发”出现在 Bitbucket 中?这些是什么意思?我做错了什么吗?
我使用git push origindevelop
将我的更改推送到远程
最佳答案
您可能一直在使用 git pull
将上游更改 pull 入本地存储库。因此,消息如下:
Merge branch 'develop' of https://bitbucket.org/org/repo (the remote repository hosted at Bitbucket) into develop (your local copy of the 'develop' branch)
请记住,git pull
本质上是 git fetch
+ git merge
。因此,它会在可能的情况下进行快进 merge ,但如果您的本地存储库和远程存储库出现分歧,Git 将执行三向 merge (这会创建一个新的提交,如屏幕截图所示)。
然后 Git 应该要求您输入提交消息:
Merge branch 'develop' of https://bitbucket.org/org/repo into develop # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
我不会太担心 merge 。然而,我个人更喜欢不同的工作流程,使用 fork 和分支:
- 将存储库 fork 到您的个人帐户
- 为您正在处理的每个功能、错误修复等创建一个新分支(我不使用“开发”分支,所以我只是从主分支分支出来)
- 进行一些提交
- 将提交推送到您个人分支上的新分支
- 当功能/错误修复/等。完成后,创建一个 pull 请求,将您的分支 merge 到共享存储库的主分支中。
这将限制三向 merge 的数量,因为您是唯一在存储库分支上工作的人。通过不时地进行 rebase ,您可以了解主存储库的最新更改,而无需不断 merge 。
但是,每次 merge pull 请求时,都会进行一次 merge 提交。但是,正如我所说,我不会担心这一点。
(我并不是告诉您应该使用此工作流程,但这只是我个人的偏好以及我们在我公司的做法。)
关于git - bitbucket 上的意外 merge ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24575624/