Git Merge-不合并来自远程分支的所有更改 [英] Git Merge - Not merging all changes from remote branch

查看:73
本文介绍了Git Merge-不合并来自远程分支的所有更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从master分支出来,创建了一个名为extra_work的分支.然后,我对master进行了很多更改,包括也删除了一些文件.现在稍后,当我尝试将分支"extra_work"合并到主数据库中时,它并没有完全合并.它不是添加我在master中删除的文件,基本上不是我已撤消的所有工作,现在我希望将其恢复到master中.如何合并这两个分支,以使"extra_work"分支中的所有其他文件/工作都合并到master中.谢谢

I branched from master and created a branch called extra_work. Then I made lots of changes to master which included removing some files as well. Later now when I tried to merge the branch 'extra_work' into the master, it is not merging it entirely. It is not adding the files that I removed in master, basically all the work that I had undone, now I want it back into my master. How do I merge these two branches so that all the extra files/work from my 'extra_work' branch merges into master. Thanks

推荐答案

根据 master 为您的 extra_work 分支重新设置基础.这会将您的 extra_work 分支倒回分支时的状态,并将来自 master 的提交应用于 extra_work .然后它将重播 extra_work 中的所有提交回自身.如果之后检查 git log ,您将在分支的历史中更早地看到来自 master 的提交.然后,您应该可以毫无问题地合并到 master .

Rebase your extra_work branch against master. This will rewind your extra_work branch to the state when you branched, and apply the commits from master to extra_work. It will then replay all the commits from extra_work back onto itself. If you inspect git log after that you will see the commits from master further back in the history of the branch. You should then be able to merge to master with no problems.

git rebase master

这篇关于Git Merge-不合并来自远程分支的所有更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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