看板 Soft_Job 關於我們 聯絡資訊
不確定可不可以幫到你。我模擬了一下你的環境。 commit 0c870ded9fe73bf0e1fdbb26b19f54a4429ee1a2 Date: Mon Nov 30 19:21:31 2015 +0800 333 commit_log commit 0b87e3b690cdcd787b07ceb834ab9c6b939503e5 Date: Mon Nov 30 19:21:19 2015 +0800 222 commit_log commit 5a6e1514c63d4c1340f89c3cf24313ae8af5cc2a Date: Thu Nov 12 13:38:52 2015 +0800 111 commit 將前面兩個 commit 交換, 我是有成功交換 descent@debian64:git_test_1$ git log commit 683f10a272119b26892814746d1d9cfbc9cfe706 Date: Mon Nov 30 19:21:19 2015 +0800 222 commit_log commit caf739dd1b7751ac98587cfc8d02cc1c16c4f66d Date: Mon Nov 30 19:21:31 2015 +0800 333 commit_log commit 5a6e1514c63d4c1340f89c3cf24313ae8af5cc2a Date: Thu Nov 12 13:38:52 2015 +0800 111 commit 用 git reflog 找到交換之前的操作, 以我的情況來說是 HEAD@{3} descent@debian64:git_test_1$ git reflog 683f10a HEAD@{0}: commit (cherry-pick): 222 commit_log caf739d HEAD@{1}: commit (cherry-pick): 333 commit_log 5a6e151 HEAD@{2}: reset: moving to 5a6e1514c63d4c1340f89c3cf24313ae8af5cc2a 0c870de HEAD@{3}: commit: 333 commit_log 0b87e3b HEAD@{4}: commit: 222 commit_log git reset --hard HEAD@{3} 就回復了。 不過還是希望你知道這是在幹嘛比較好。 大底就是 work tree, index, branch 的操作。 先備份整個 git repository 比較保險。 ※ 引述《zeqw (重心)》之銘言: : 想請問以下這樣的情況是否還有救, : 原本有兩個commit, 想把它交換順序, : 用了git rebase -i然後把兩筆資料調換, : 調換後又下了git rebase --contiune : 然後其中某一筆就不見了, : 是否已經沒救了? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.98.177.194 ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1448883402.A.FDD.html