将外部更改合并到我的Git仓库中的最佳方式是什么? [英] What's the best way to merge external changes into my Git repo?

查看:136
本文介绍了将外部更改合并到我的Git仓库中的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Git仓库中有一个项目,并且我发送了在Git之外完成的更改。这些更改是基于我对自己进行更改的早期版本。

I have a project in a Git repo and I have been sent changes that have been made outside of Git. These changes are based on an earlier version that I have been making changes to myself. What is the best way to merge these external files with mine?

非常感谢!

Many thanks!

推荐答案

最好的方法是告诉git他们基于哪个提交,以便为您提供自动合并的最佳机会。

The best way is to tell git what commit they were based off of, to give you the best chance of an automatic merge.


  1. 旧提交的git checkout< sha1> -b mybranch ,倒回工作树并开始一个新分支。

  2. 如果更改是以差异形式发送的,请使用 git -apply 将其应用于工作树,否则只需放入更新的文件。

  3. 添加并提交文件。

  4. git checkout master ,然后 git merge mybranch

  1. git checkout <sha1 of the old commit> -b mybranch, to rewind your work tree and start a new branch.
  2. If the changes were sent as a diff, use git-apply to apply them to the work tree, otherwise just put the updated files in.
  3. Add and commit the files.
  4. git checkout master, then git merge mybranch.

这篇关于将外部更改合并到我的Git仓库中的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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