git flow 分支有分歧

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10197188/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 13:29:59  来源:igfitidea点击:

git flow branches have diverged

gitgit-flow

提问by Paul Cezanne

I'm using the git flow tools and I've gotten myself in a bit of problem. My git branches have diverged. I've read master branch and 'origin/master' have diverged, how to 'undiverge' branches'?and have tried to follow the steps, both attempting to merge and to rebase my local repository.

我正在使用 git flow 工具,但遇到了一些问题。我的 git 分支出现了分歧。我读过master 分支并且“origin/master”已经分歧,如何“undiverge”分支?并尝试遵循这些步骤,尝试合并和重新设置我的本地存储库。

    $  git flow feature finish showFindLogs
    Branches 'develop' and 'origin/develop' have diverged.
    And branch 'develop' may be fast-forwarded.
    $  git merge origin/develop
    Already up-to-date.
    $ git rebase origin/develop
    Current branch feature/showFindLogs is up to date.
    $ git status
    # On branch feature/showFindLogs
    nothing to commit (working directory clean)

How can I get out of this? I'm done with the git flow feature and I'd just like to get my changes up to the remote. Thanks!

我怎样才能摆脱这种情况?我已经完成了 git flow 功能,我只想将我的更改发送到远程。谢谢!

回答by CharlesB

What happens here is that the remote has received updates, and git-flow requires that developand origin/developto be at the same commit before merging back the feature. This is to prevent bad conflicts when publishing the branch.

这里发生的是,遥控器已收到更新,和git-流量要求develop,并origin/develop为在合并回功能之前同样提交。这是为了防止发布分支时出现不良冲突。

To solve this, you need to:

要解决此问题,您需要:

  1. sync your local developwith origin: checkout develop, and pull from originto develop(git checkout develop && git pull origin)

  2. rebase your feature on developwith git flow feature rebase showFindLogs. You may have conflicts here if you're unlucky

  3. check that it doesn't break anything

  4. git flow feature finish showFindLogs

  1. 同步本地developorigin:结账develop,并从拉origindevelopgit checkout develop && git pull origin

  2. 变基上的功能developgit flow feature rebase showFindLogs。如果你不走运,你可能会在这里发生冲突

  3. 检查它没有破坏任何东西

  4. git flow feature finish showFindLogs

回答by Bruno Peres

Make sure your developbranch is not behind origin, maybe you need to perform

确保您的develop分支不落后于原点,也许您需要执行

git checkout develop

git checkout develop

git pull

git pull

git checkout release/x.x.x

git checkout release/x.x.x

And continue the release process

并继续发布过程

回答by childno?.de

you might also want to ((as long it is not officially supported) patch and) use my

您可能还想((只要它不受官方支持)修补并)使用我的

git-flow feature finish -poption

git-flow feature finish -p选项

https://github.com/nvie/gitflow/pull/253

https://github.com/nvie/gitflow/pull/253

回答by Manolo

You can fetch from $ORIGIN before finish feature with this command:

您可以使用以下命令在完成功能之前从 $ORIGIN 获取:

git flow feature finish -F <name>

(docs)

文档

回答by Shoham

For whoever googling this error, and using Hub-Flow- just do:

对于在谷歌上搜索此错误并使用Hub-Flow 的人- 只需执行以下操作:

git hf update

回答by Micha? Rowicki

For solve that problem you can use my implementation of git flow, based on @childno?.de solution.

为了解决这个问题,你可以使用我的 git flow 实现,基于@childno?.de 解决方案。

git flow feature/hotfix/release/bugfix  -e finish <name>

To install git flow execute in console:

要在控制台中安装 git flow 执行:

git clone https://github.com/wyhasany/gitflow-avh/;cd gitflow-avh/;git checkout feature/force_merge;git pull;sudo make install