以下是情況:某些提交已在遠程存儲庫中完成。從遠程git存儲庫中恢復未提交的提交
不幸的是,有人做了push -f
,這樣沒有遠程分支再引用這些提交。
更糟的是,我沒有在我的本地克隆提交這些提交。
我的目標基本上是恢復這些提交。這些都是一些我試過的東西:
git checkout -b recovery <commit_id>
:致命的:引用不是一棵樹git push origin <commit_id>:recovery
error: refs/heads/recovery does not point to a valid object! error: unable to push to unqualified destination: recovery The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref.
Thanks @Wim!這個解決方案爲我工作。 – Sergey