logo
  • 教程列表
  • SO官方文檔
  • 恢復
    • 從丟失的提交中恢復
    • 提交後恢復已刪除的檔案
    • 將檔案還原到以前的版本
    • 恢復已刪除的分支
    • 從重置中恢復
    • 從 git stash 中恢復
  1. StackOverflow 文件
  2. Git 教程
  3. 恢復
  4. 從丟失的提交中恢復

從丟失的提交中恢復

Created: November-22, 2018

如果你已恢復到過去的提交併丟失了較新的提交,則可以通過執行來恢復丟失的提交

git reflog

然後找到丟失的提交,並通過執行重置回來

git reset HEAD --hard <sha1-of-commit>
  • 提交後恢復已刪除的檔案
  • 恢復

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明