Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git HEAD 丢失,如何找回 #3

Open
yangruihan opened this issue Aug 4, 2020 · 0 comments
Open

Git HEAD 丢失,如何找回 #3

yangruihan opened this issue Aug 4, 2020 · 0 comments
Labels

Comments

@yangruihan
Copy link
Owner

Git HEAD 丢失,如何找回

当提交了一些内容到 HEAD 后,又不小心 checkout 到其他分支,这时 GUI 工具里可能就再也找不到 HEAD 那次对应的提交了

此时可以使用git reflog命令来显示刚才提交的信息,找到 HEAD 那次提交并将其 SHA1 复制下来,在使用git checkout xxxxx(对应的 SHA1) 就可以恢复到那次提交了

@yangruihan yangruihan added the git label Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant