Featured image of post 取消誤執行的git reset方法|還原Commit步驟

取消誤執行的git reset方法|還原Commit步驟

為您解說當在Git中不小心執行了「git reset」時,如何取消重置並還原到原本的Commit狀態。文章將清楚介紹使用「git reflog」確認Commit ID,並正確恢復狀態的步驟。

如何取消 git reset

如果在進行 git commit 之後,不小心執行了 git reset,這裡介紹如何取消 git reset(如何復原到 git commit 時的狀態)。

  1. 使用 git reflog 確認 reset 前的 commit ID
  2. 使用 git reset --hard HEAD@{數字} 恢復到 reset 前的狀態

以上就是如何取消 git reset 的方法。

comments powered by Disqus
使用 Hugo 建立
主題 StackJimmy 設計