git隐藏报告:''不是隐藏引用 [英] git stash reporting: '' is not a stash reference

查看:786
本文介绍了git隐藏报告:''不是隐藏引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 %git存储列表$ b 

不太清楚发生了什么,但是git存储似乎不太合适。 $ b $ stash @ {0}:filter-branch:rewrite
stash @ {1}:filter-branch:rewrite
stash @ {2}:在mysolr:start mysolr stuff

可以,并且 git show stash @ {0} 可以正常工作。但是:
$ b $

 %git stash drop 
''不是存储引用
%git stash pop
''不是隐藏引用
%git隐藏drop stash @ {0}
'隐藏@ {0}'不是隐藏引用

过去我使用过很多git,而没有遇到这种情况。我最近重写了历史记录,以便在发布到github之前从历史记录中删除文件。然后我跑的命令是

$ g $ p $ g $ git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch FILENAME'\
--prune-empty --tag-name-filter cat - --all

任何想法如何修复隐藏?

解决方案

code> filter-branch 破坏了你的存储空间。如果 git存储的参数与存储袋不够类似,你得到不是隐藏引用申诉。



请注意 git show stashref 使用普通的旧的 git show ,它不要求作为参数给出的提交类似于存储。如果 git stash show 以与其他 git stash 命令相同的方式失败,或者手动检查有问题的存储表明它不再是双亲或三父合并提交,那么事实上就是这样。



可能是 - 修剪空在这里做了。如果您在存储时没有添加任何内容,那么索引提交将为空。一般来说,避免过滤存储引用可能更为明智。



您可以尝试两种不同的方法:


  • refs / original / (其中 filter-branch )恢复原始隐藏SHA-1 >留下他们)和/或reflogs;使用它们重建 refs / stash 和/或存储引用日志,或者直接使用它们,然后打开存储引用和它的引用日志。
  • 在重写的存储区中只使用剩余的工作树提交。所有你真正需要的,因为索引提交是空的,那是一个工作树提交。您可以使用已运行的 git show 命令获得修补程序。


< (对于隐藏和藏匿袋子,包括与一起使用的三父形式 - 所有 - 未追踪,请参阅如何从git stash save --all?中恢复。)



假设你已经取回了你的内容,并且希望完全清除存储引用,这可以做到。请注意,这是从轨道上核弹选项 - 不要直到你确定你准备好了:

  git update-ref -d refs / stash 


Not quite sure what's happened, but git stash seems to be in a bad place.

% git stash list
stash@{0}: filter-branch: rewrite
stash@{1}: filter-branch: rewrite
stash@{2}: On mysolr: start mysolr stuff

Is OK, and git show stash@{0} works fine. But:

% git stash drop
'' is not a stash reference
% git stash pop
'' is not a stash reference
% git stash drop stash@{0}
'stash@{0}' is not a stash reference

I've used git stash plenty in the past and not come across this. I had recently rewritten history to remove a file from history before publishing to github. The command I ran then was

git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch FILENAME' \
  --prune-empty --tag-name-filter cat -- --all

Any ideas how to fix the stash?

解决方案

I think filter-branch has broken your stashes. If the argument to git stash does not sufficiently resemble a stash bag, you get that not a stash reference complaint.

Note that git show stashref uses plain old git show, which does not require that a commit given as an argument resemble a stash. If git stash show fails the same way as the other git stash commands, or if manual examination of the stash in question shows that it's no longer a two- or three-parent merge commit, then this is in fact the case.

It was likely the --prune-empty that did it here. If you had not added anything at the time of the stash, the index commits would be empty. In general it's probably wiser to avoid filtering stash refs.

You can try two different approaches:

  • Recover the original stash SHA-1(s) from refs/original/ (where filter-branch left them) and/or reflogs; use those to rebuild refs/stash and/or the stash reflogs, or use them directly and then clobber the stash ref and its reflog.
  • Use just the remaining work-tree commits in the rewritten stashes. All you really need, since the index commits were empty, is that one work-tree commit. You can get a patch using the git show command you've already run.

(For a bit more on stash and stash bags, including the three-parent form used with --all or --untracked, see How to recover from "git stash save --all"?.)

Assuming you have gotten your contents back and wish to wipe out the stash reference entirely, this will do it. Note that this is the "nuke it from orbit" option—don't do it until you're sure you're ready:

git update-ref -d refs/stash

这篇关于git隐藏报告:''不是隐藏引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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