[英]Revert git reset HEAD to last commit changes
By mistake i have executed below commands 我错误地执行了以下命令
git reset HEAD
git reset 'HEAD@{1}'
git reset ORIG_HEAD
Now my latest changes are not showing on remote server. 现在,我的最新更改未显示在远程服务器上。
Which command need to execute i'm on dev branch 我需要在开发分支上执行哪个命令
You can copy your desired commit
you want to back from git log --walk-reflogs
. 您可以从
git log --walk-reflogs
复制desired commit
。 Then reset
your branch ( dev
) to the commit-sha
. 然后
reset
您的分支( dev
) reset
为commit-sha
。
$ git checkout dev
$ git log --walk-reflogs # copy desired commit-sha
$ git reset --hard <commit-sha> # reset 'dev' branch on the commit
$ git push -f origin HEAD # force(-f) push as history is changed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.