Git告诉我拉,然后提交,然后拉? [英] Git telling me to pull, then commit, then pull?

查看:107
本文介绍了Git告诉我拉,然后提交,然后拉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图推进新的更改,但我有一个冲突的文件。尝试推送后,出现以下错误:

I am trying to push new changes, but I have a conflicted file. After trying to push, I get the following error:

Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

好的,所以我们需要使用git pull。
我尝试使用 git pull ,然后我得到这个错误:

Ok, so we need to use git pull. I try to use git pull and then I get this error:

error: Your local changes to the following files would be overwritten by merge:
    db/profile_edit.php
Please, commit your changes or stash them before you can merge.

但是,当我尝试提交时,我会回到第一个错误。我该怎么办?远程repo上的更改比本地计算机上的更新更新。那么,我该如何使用diff工具打开它并进行更改,然后告诉git我已经进行了更改,以便它能够推送更改?

But, when I try to commit, I go back to the first error. What should I do? The changes on the remote repo are newer than the ones on my local machine. So, how do I open it up with a diff tool and make the changes and then tell git that I have made changes so it will let me push changes?

推荐答案

试着做

$ git pull --rebase

在您之前拉取远程更改,然后提交。看看它是否有效。

To pull remote changes before yours, and then commit. And see if it works.

如果这不起作用,可以试试这个:

If this does not work, try this instead:

$ git stash
$ git pull --rebase
$ git stash pop

要将更改保存到存储中,请在您的工作存储库中应用远程提交,然后应用您的更改(保存到隐藏)再次存放在您的工作存储库中。

To save your changes on the stash, apply remote commits inside your work-repository, and then apply your changes (saved into stash) inside your work-repository again.

这篇关于Git告诉我拉,然后提交,然后拉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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