Git不会从另一个分支中提取更改吗? [英] Git won't pull changes from another branch?

查看:60
本文介绍了Git不会从另一个分支中提取更改吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该注意到,这些更改是应该从集成"分支中进行的应已合并.他们以某种方式没有将其纳入合并,现在Git不会添加它们,因为它坚持认为分支是已经是最新的".嗯.

I should have noted that these are changes which should already have been merged from the "integration" branch. They somehow did not make it into that merge, and now Git won't add them because it insists the branch is "Already up-to-date". Arrgh.

当我尝试将另一个分支合并到它时,Git不会更新我的分支.

Git won't update my branch when I try to merge another branch into it.

此文件在另一个分支中有差异,但是当我尝试合并该分支时,Git告诉我已经是最新的":

This file's got differences in another branch, but when I try to merge that branch, Git tells me "Already up-to-date":

$ git diff --stat integration MyApp/src/main/webapp/WEB-INF/jsp/flow/appInfo.jsp
 .../webapp/WEB-INF/jsp/flow/appInfo.jsp    | 54 ++++------------------
 1 file changed, 10 insertions(+), 44 deletions(-)

$ git merge integration
Already up-to-date.

我不太确定这怎么可能-有人可以解释这种情况如何发生吗?

I'm not really sure how this is possible - can anybody explain how this situation can happen?

推荐答案

当您要求git合并时,它会根据分支之间历史记录的形状来决定要做什么.由于git报告它已经是最新的,因此integration必须是HEAD的祖先.您可以通过查看以下内容来调查这种情况:

When you ask git to merge, it decides what to do based on the shape of the history between the branches. Since git is reporting that it's already up to date, integration must be an ancestor of HEAD. You can investigate how this came to be by looking at the output of:

git log --oneline --graph --decorate integration HEAD

如果您想用integration分支中的文件替换该文件的本地版本,则可以执行单文件检出:

If you'd like to replace your local version of that file with the one from the integration branch, you can do a single-file checkout:

git checkout integration -- MyApp/src/main/webapp/WEB-INF/jsp/flow/appInfo.jsp

或者,您可以执行补丁签出以分别查看每个差异块并决定是否应用它:

Alternatively, you can do a patch-checkout to view each diff chunk individually and decided whether or not to apply it:

git checkout -p integration -- MyApp/src/main/webapp/WEB-INF/jsp/flow/appInfo.jsp

这篇关于Git不会从另一个分支中提取更改吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆