Git:由于未提交的更改而无法重新绑定 [英] Git: Cannot rebase because of uncommitted changes

查看:194
本文介绍了Git:由于未提交的更改而无法重新绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git不会让我从任何地方变质。

 无法重定位:您的索引包含未提交的更改。 
请提交或储存它们。

遵循以下答案的指示: https://stackoverflow.com/a/13694625/618450

  $ git update -index -q --ignore-submodules --refresh 
$ git diff-files --ignore-submodules

两者都不会产生任何输出,但是这样做:

  $ git diff-index --cached  - 忽略-子模块HEAD  -  
:100644 000000 cab819f1e5ed6cc7cff374eecae273e1d6ae6a01 0000000000000000000000000000000000000000 d .idea / codeStyleSettings.xml
:100644 000000 2953f353d2c65dd62e36926accb7f645a600b7e0 0000000000000000000000000000000000000000 d .idea /字典/ roxy.xml
:100644 000000 0e7ecef362d8a77067edf4bae5972f33185bd986 0000000000000000000000000000000000000000 d .idea / inspectionProfiles / Project_Default.xml
:100644 000000 3b312839bf2e939fea3ebdef15630a4b33e57caf 0000000000000000000000000000000000000000 D .id ea / inspectionProfiles / profiles_settings.xml
:100644 000000 e31af55b33d82e28f471a2ba51b63c2a91fa53b7 0000000000000000000000000000000000000000 D .idea / php.xml
:100644 000000 9c25e8d4f1169b5d3103b14fdb60e7d7c3975b70 0000000000000000000000000000000000000000 D db / sfront.sql

我无法删除这些文件:

  $ git rm --cached .idea / php.xml 
fatal:pathspec'.idea / php.xml'不匹配任何文件

任何可以帮助我的想法?

编辑:
git存储


解决了我的问题。我不确定我是否理解发生了什么。它抱怨的文件应该被忽略。

解决方案

git存储将不同的文件存储在其他地方,将您的工作目录返回到上次提交。完成rebase之后,运行 git stash pop 。这将把这些文件返回到工作目录,并允许你像以前一样工作。



编辑:学习所有关于 git存储的好链接命令: Git Tools - Stashing


Git won't let me rebase from anywhere.

Cannot rebase: Your index contains uncommitted changes.
Please commit or stash them.

Following the instructions from this answer: https://stackoverflow.com/a/13694625/618450

$ git update-index -q --ignore-submodules --refresh
$ git diff-files --ignore-submodules

Both do not produce any output but that one does:

$ git diff-index --cached --ignore-submodules HEAD --
:100644 000000 cab819f1e5ed6cc7cff374eecae273e1d6ae6a01     0000000000000000000000000000000000000000 D  .idea/codeStyleSettings.xml
:100644 000000 2953f353d2c65dd62e36926accb7f645a600b7e0 0000000000000000000000000000000000000000 D  .idea/dictionaries/roxy.xml
:100644 000000 0e7ecef362d8a77067edf4bae5972f33185bd986 0000000000000000000000000000000000000000 D  .idea/inspectionProfiles/Project_Default.xml
:100644 000000 3b312839bf2e939fea3ebdef15630a4b33e57caf  0000000000000000000000000000000000000000 D    .idea/inspectionProfiles/profiles_settings.xml
:100644 000000 e31af55b33d82e28f471a2ba51b63c2a91fa53b7 0000000000000000000000000000000000000000 D  .idea/php.xml
:100644 000000 9c25e8d4f1169b5d3103b14fdb60e7d7c3975b70 0000000000000000000000000000000000000000 D  db/sfront.sql

and I can't delete those files:

$ git rm --cached .idea/php.xml
fatal: pathspec '.idea/php.xml' did not match any files

Any ideas that can help me?

EDIT: git stash

Fixed my problem. I'm not sure I understand what happened though. The files that it complain about were supposed to be ignored.

解决方案

git stash stores the different files away from everything else, returning your working directory to the last commit. Once you have done your rebase, run git stash pop. This will return those files to the working directory and allow you to work as before.

EDIT: A good link for learning all about the git stash command: Git Tools - Stashing

这篇关于Git:由于未提交的更改而无法重新绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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