我如何回滚到特定的git commit [英] How do I rollback to a specific git commit
问题描述
我已经使用这个命令回滚了 git reset --hard HEAD ^
以前的提交,我想要做的就是前滚我知道这不是正确的术语来说明我最近做了什么。发生了什么是一堆文件被删除,当我使用该命令,现在我不知道如何回来。我使用github有没有办法从github上拉下来并覆盖当前目录?
I have rolled back already using this command git reset --hard HEAD^
to some previous commit, all I want to do is rollforward I know this isn't the correct term to what would be my commit that I did latest. Whats happening is a bunch of files were deleted when I used that command and now I don't know how to get back. I am using github is there a way to just pull down from github and overwrite the current directory?
推荐答案
查看你的问题,您想要检索的提交是GitHub仓库 master
分支上的当前仓库,您必须执行以下操作
Looking at your question, the commit you want to retrieve is the current one on the master
branch of the GitHub repo, you have to do the following
git reset --hard origin/master
警告这将清除所有未提交的修改,这些修改在您回滚到 HEAD ^
之后可能已做出。
WARNING this will erase all uncommitted modifications that you could have made since you rolled back on HEAD^
.
之前,您可能要做的事情
Before, you might want to do
git fetch origin
确保您获得了GitHub回购的最新更改。
To make sure you've got the latest changes from the GitHub repo.
这篇关于我如何回滚到特定的git commit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!