错误:无法使用rebase进行提取:您有未执行的更改 [英] Error: Cannot pull with rebase: You have unstaged changes

查看:3692
本文介绍了错误:无法使用rebase进行提取:您有未执行的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始与一些朋友合作开展一个项目,他们使用heroku git仓库。

我前几天克隆了仓库,他们已经做了一些修改,所以我试图获得最新的更新。



我运行了 git pull --rebase 命令(这是正确的方法吗?): https://devcenter.heroku.com/articles/sharing#merging-code-changes



我得到以下错误:

  $ git pull --rebase 
无法用rebase拉取:您有未分配的更改。
请提交或储存它们。

我的猜测是我弄乱了代码,现在它希望我提交或放弃(那是什么意思?)变化。这是发生了什么?如果是这种情况,我想放弃我可能做出的任何更改,并从git存储库中获取更新后的代码。



任何想法我可以做什么?

解决方案

code> git status ,这会告诉你哪些文件已经改变。由于您声明您不希望保留更改,因此您可以执行 git checkout - <文件名称> git reset --hard $ b

在大多数情况下,git会告诉您如何处理更改。例如,你的错误消息说 git stash 你的改变。这将是如果你想保留它们。之后,您将执行 git stash pop 并且您的更改将被重新应用。



git status 也有如何摆脱取决于文件是否被提交进行提交的改变。

I have started collaborating with a few friends on a project & they use the heroku git repository.

I cloned the repository a few days ago and they have since made some changes so I am trying to get the latest updates

I ran the git pull --rebase command as stated here(Is this the right way to do it?): https://devcenter.heroku.com/articles/sharing#merging-code-changes

I get the following error:

$ git pull --rebase
Cannot pull with rebase: You have unstaged changes.
Please commit or stash them.

My guess is that I messed around with the code and now it wants me to either commit or discard(is that what does stash means?) the changes. Is this what is happening? If this is the case I would like to discard any changes I might have made and just get the updated code from the git repository.

Any idea of what I can do?

解决方案

Do git status, this will show you what files have changed. Since you stated that you don't want to keep the changes you can do git checkout -- <file name> or git reset --hard to get rid of the changes.

For the most part, git will tell you what to do about changes. For example, your error message said to git stash your changes. This would be if you wanted to keep them. After pulling, you would then do git stash pop and your changes would be reapplied.

git status also has how to get rid of changes depending on if the file is staged for commit or not.

这篇关于错误:无法使用rebase进行提取:您有未执行的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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