简体   繁体   English

从git push -f恢复

[英]Recovering from git push -f

I am totally new to programming and I'm using GIT first time. 我对编程完全陌生,并且是第一次使用GIT。

I am trying to build Ruby web app and I had problems to git push and somebody told me to use git push -f. 我正在尝试构建Ruby Web应用程序,但在git push时遇到问题,有人告诉我使用git push -f。 But now I read that it was probably really bad thing to do. 但是现在我读到,这可能真的很不好。 Now when I try to git push I get this message from command line: 现在,当我尝试进行git push时,我从命令行得到了以下消息:

"You are not currently on a branch. To push the history leading to the current (detached HEAD) state now, use “您当前不在分支上。要现在将历史记录推送到当前(分离的HEAD)状态,请使用

git push origin HEAD:" git push origin HEAD:”

How should I try to recover from this? 我应该如何尝试从中恢复?

Thank you! 谢谢!

使用git reflog来检查您是否有远程/原点/主站指向的先前提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM