本文介绍了Git合并报告“已经是最新的"虽然有区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 2 个分支的 git 存储库:master 和 test.

主分支和测试分支之间存在差异.

两个分支都提交了所有更改.

如果我这样做:

git 结帐大师
git 差异测试

出现一个充满变化的屏幕,显示差异.我想合并测试分支中的更改,所以这样做:

git 合并测试

但是收到消息已经是最新的"

然而,检查每个不同分支下的文件可以清楚地发现差异.

这里有什么问题,我该如何解决?

解决方案

Already up-to-date"消息意味着您尝试合并的分支中的所有更改都已合并到您的分支中.重新当前.更具体地说,这意味着您尝试合并的分支是当前分支的父分支.恭喜,这是你做过的最简单的合并.:)

使用 gitk 查看您的存储库.test"分支的标签应该在你的master"分支标签下方.

您的分支相对于其父分支是最新的.根据合并,自上次合并以来父级没有新的变化.这并不意味着分支是相同的,因为您可以在工作分支中进行大量更改,这听起来像您一样.

编辑 10/12/2019:

根据 Charles Drake 对此答案的评论,解决问题的一种解决方案是:

git checkout mastergit reset --hard 测试

这将它带回到测试"级别.

然后做:

git push --force origin master

为了强制更改回中央存储库.

I have a git repository with 2 branches: master and test.

There are differences between master and test branches.

Both branches have all changes committed.

If I do:

git checkout master
git diff test

A screen full of changes appears showing the differences. I want to merge the changes in the test branch and so do:

git merge test

But get the message "Already up-to-date"

However, examining files under each different branch clearly shows differences.

What's the problem here and how do I resolve it?

解决方案

The message "Already up-to-date" means that all the changes from the branch you’re trying to merge have already been merged to the branch you’re currently on. More specifically it means that the branch you’re trying to merge is a parent of your current branch. Congratulations, that’s the easiest merge you’ll ever do. :)

Use gitk to take a look at your repository. The label for the "test" branch should be somewhere below your "master" branch label.

Your branch is up-to-date with respect to its parent. According to merge there are no new changes in the parent since the last merge. That does not mean the branches are the same, because you can have plenty of changes in your working branch and it sounds like you do.

Edit 10/12/2019:

Per Charles Drake in the comment to this answer, one solution to remediate the problem is:

git checkout master
git reset --hard test

This brings it back to the 'test' level.

Then do:

git push --force origin master

in order to force changes back to the central repo.

这篇关于Git合并报告“已经是最新的"虽然有区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 17:17