即使所有更改都已提交,Git会要求我在结算主机上提交或隐藏更改? [英] Git asks me to commit or stash changes on checkout master, even though all changes were committed?

查看:178
本文介绍了即使所有更改都已提交,Git会要求我在结算主机上提交或隐藏更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地有两个分行, master Berislav 。后者目前活跃,我已经承诺所有的变化。当我尝试结帐到 master 时,我收到以下消息:

I have two branches locally, master and Berislav. The latter is currently active, and I have committed all the changes. When I try to checkout to master, I get the following message:


错误:您在本地对以下文件的更改将被checkout覆盖
:[在活动分支中更改的文件列表]请
在您切换分支之前提交您的更改或存储它们。
正在中止

error: Your local changes to the following files would be overwritten by checkout: [list of files changed in the active branch] Please, commit your changes or stash them before you can switch branches. Aborting

然而,我尝试过的所有其他事情 - commit status merge - 告诉我没有什么要提交的(工作目录干净)。我需要做什么才能到达我的 master 分支?

However, everything else I tried -- commit, status, merge -- tells me that there's nothing to commit (working directory clean). What do I need to do to get to my master branch?

编辑:当我尝试 git stash ,我得到:

When I try git stash, I'm getting:


错误:将未修改的[文件路径]提供给diffcore

error: feeding unmodified [file path] to diffcore

列出上述错误中的所有文件。

for all the files listed in the error above.

推荐答案

今天我遇到了类似的问题。 git status 未列出结帐时抱怨的文件。我做了一个:

I encountered a similar problem today. git status wasn't listing the files which checkout was complaining about. I did a:

git checkout -- path/to/file

然后解除对文件的任何更改。

And that undoes any changes to the file.

更简单的方法可以撤消所有未分离的更改当前工作目录 [1]

An even easier way to undo all unstaged changes on current working directory [1]:

git checkout -- .

[1] - 警告 - 您将失去其他未分离的更改你正在研究(如果有的话)。如果您不知道自己在做什么,请保留您正在处理的文件的备份:)

[1] - Be warned - you will lose any other unstaged changes you were working on (if any). If you don't know what you are doing, then keep a backup of the files you were working on :)

这篇关于即使所有更改都已提交,Git会要求我在结算主机上提交或隐藏更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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