【问题标题】:Git pull gives "Already up to date" but remote branch shows confilctsGit pull 给出“已经是最新的”但远程分支显示冲突
【发布时间】:2021-11-30 19:55:29
【问题描述】:

所以我最近才开始使用更多的 git 功能,我有点迷茫。

  • 我从 master 分支克隆了 repo。

  • 做了一些编码。

  • git checkeout -b newbranch 然后git commitgit push origin newbranch

  • 我确实在 bitbucket 中拉取请求,但它指向 master 分支,我被告知将其指向 develop 分支,所以我做到了。然后我得到:

  • 所以在我的终端中我做了git checkout develop,但是当我尝试git pull 时,我收到了Already up to date 消息。因此,如果develop 分支与newbranch 不同并且它会导致冲突,为什么我不能拉它?这里有什么不明白的地方?

我需要从develop 分支获取代码,解决冲突,然后再次推送并再次执行拉取请求。

【问题讨论】:

    标签: git pull-request git-pull


    【解决方案1】:

    你需要解决的冲突在developnewbranch之间。

    从本地仓库解决此问题的两种主要方法是:

    1. develop 之上重新设置newbranch
    # from branch 'newbranch' :
    git checkout newbranch
    
    # rebase on top of 'develop' :
    git rebase develop
    
    # if you actually need to edit or drop commits along the way, you may use
    # an interactive rebase :
    git rebase -i develop
    
    1. develop 合并到newbranch
    # from branch 'newbranch' :
    git checkout newbranch
    
    # merge 'develop' :
    git merge develop
    

    选择适合您工作流程的方式。

    您需要修复冲突才能完成这些操作中的任何一个 - 您的遥控器说有一些。


    一旦您对本地存储库中更新的newbranch 感到满意,请将其推送到您的远程:

    git push origin newbranch
    
    # if you ran rebase, you will need to force push your branch :
    git push --force-with-lease origin newbranch
    

    【讨论】:

    • 第一个效果很好。我确实做了第二个,因为在解决冲突之前我无法合并。谢谢。
    猜你喜欢
    • 2015-03-11
    • 1970-01-01
    • 2013-11-20
    • 2021-04-15
    • 2020-01-21
    • 2016-05-03
    • 2016-05-02
    • 2012-01-16
    • 1970-01-01
    相关资源
    最近更新 更多