[英]How do reset/revert a git reset HEAD~
By mistake I did a git reset HEAD~
in my branch.我错误地在我的分支中做了一个git reset HEAD~
。 I see all my changed files on my local.我在本地看到了所有更改的文件。 I don't want to change anything.我不想改变任何事。 The branch is good as is.分支机构很好。
What do I have to do?我需要做什么?
If you haven't done anything else, just do this command git reset --hard HEAD@{1}
.如果您没有做任何其他事情,只需执行此命令git reset --hard HEAD@{1}
。 If you've made other changes, do git reflog show
to see which commit you want to revert back to.如果您进行了其他更改,请执行git reflog show
以查看要还原到哪个提交。 Then do git reset --hard XXX
and put that commit ID in the XXX part.然后执行git reset --hard XXX
并将该提交 ID 放入 XXX 部分。
You then git push --force
to make sure your remote branch reflects the change.然后您git push --force
以确保您的远程分支反映更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.