首页 > 解决方案 > Git说master是最新的,但不是

问题描述

我有一个 repo,其中我已将更改推送到 master 分支,然后我创建了其他分支(4taFase)并开始在那里进行一些推送。完成工作后,我想推送到 MASTER,所以我签出到 master,但它说它是最新的,但显然不是(我做了 git add、commit 和 push)。我已经尝试过 git pull、git merge 和我在互联网上阅读的所有内容。请帮助和感谢。

标签: gitrepositorybranch

解决方案


从您的描述中,我看到您目前有 2 个分支:

  1. 掌握
  2. 4taFase

4taFase 基于 master 但有几个 master 没有的提交。如果是这样,您有以下选择:

  1. 从4taFase合并到 master。您将在 4taFase 中完成的所有工作都复制到 master 中,但只需一次提交。

    git checkout master git merge 4taFase

  2. cherry-pick以将特定的提交从4taFase转移到master

    git checkout master git cherry-pick <commit-hash from 4taFase>


推荐阅读