无法删除/重置重命名文件的本地修改

时间:2014-07-28 16:48:08

标签: git

我重命名了一个文件,因为它有错误的情况,然后(稍后)执行了git stash

执行此操作后,文件仍保留本地修改。我一直试图删除更改/重置HEAD但没有运气; git只是在文件名的两个版本之间交替,一个以~iphone.storyboard结尾,另一个~iPhone.storyboard

以下是我尝试的内容:

git checkout FILE

斩波器:〜/代码/里奥> git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iPhone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

斩波器:〜/代码/里奥&GT; git checkout&#39; Rio / Resources-iPhone / RIOLoginFlow~iPhone.storyboard&#39;

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iphone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

斩波器:〜/代码/里奥&GT; git checkout&#39; Rio / Resources-iPhone / RIOLoginFlow~iphone.storyboard&#39;

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iPhone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

git reset --hard,git checkout -f

斩波器:〜/代码/里奥&GT; git reset --hard

HEAD is now at 6c5c577 Join login fields into first login view

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iphone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

斩波器:〜/代码/里奥&GT; git reset --hard

HEAD is now at 6c5c577 Join login fields into first login view

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iPhone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

RM

斩波器:〜/代码/里奥&GT; rm Rio / Resources-iPhone / RIOLoginFlow~iPhone.storyboard

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    deleted:    Rio/Resources-iPhone/RIOLoginFlow~iPhone.storyboard
    deleted:    Rio/Resources-iPhone/RIOLoginFlow~iphone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

斩波器:〜/代码/里奥&GT; git reset --hard

HEAD is now at 6c5c577 Join login fields into first login view

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iPhone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")

git rm -f,git mv -f(到无关的文件名)

与上面的rm类似的结果。

git add

似乎无效。

斩波器:〜/代码/里奥&GT; git add&#39; Rio / Resources-iPhone / RIOLoginFlow~iPhone.storyboard&#39;

斩波器:〜/代码/里奥&GT; git status

On branch mrb-login-flow
Your branch is up-to-date with 'origin/mrb-login-flow'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Rio/Resources-iPhone/RIOLoginFlow~iPhone.storyboard

no changes added to commit (use "git add" and/or "git commit -a")
OS X 10.9.4上的git版本1.8.5.2(Apple Git-48)

2 个答案:

答案 0 :(得分:0)

我对整个项目进行了调整,并将其移至Linux机器(git版本1.7.10.4)。使用区分大小写的文件系统,我能够清理它,再次将其重新启动并将其移回。

答案 1 :(得分:0)

不确定这是不是你的问题,但我只是有类似的东西,我用gitk做了刚刚发生的事情的恢复提交然后做了git checkout head~files / I / Want / To / Keep / From / Original / commit file2 file3 ...