如何在 GitHub 上合并远程更改? [英] How to merge remote changes at GitHub?

查看:46
本文介绍了如何在 GitHub 上合并远程更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试第一次 Github 推送时遇到以下错误:

I'm getting following error, whn trying first Github push:

[rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:me/me.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.

如何解决此问题并合并远程更改?

how can I fix this and merge remote changes?

推荐答案

请参阅git push --help' 了解详情.

您可以执行git pull",解决潜在的冲突,并git push"结果.git pull"将在提交 A 和 B 之间创建一个合并提交 C.

You can perform "git pull", resolve potential conflicts, and "git push" the result. A "git pull" will create a merge commit C between commits A and B.

或者,您可以使用git pull --rebase"将 X 和 B 之间的更改重新设置在 A 之上,并将结果推回.rebase 将创建一个新的提交 D,它在 A 之上构建 X 和 B 之间的更改.

Alternatively, you can rebase your change between X and B on top of A, with "git pull --rebase", and push the result back. The rebase will create a new commit D that builds the change between X and B on top of A.

这篇关于如何在 GitHub 上合并远程更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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