2017-08-17 127 views
2

我要尋找一個TortoiseGit操作,相當於:TortoiseGit等同「TortoiseSVN的 - >顯示日誌 - >恢復到此版本」

TortoiseSVN --> Show log --> Revert to this revision 

在TortoiseSVN中,該操作將恢復本地存儲庫選中修訂版,同時保留所有更改的文件。

換句話說,當我做TortoiseSVN --> Check for modifications時,已更改的文件就會顯示出來,當我完成測試時,我可以輕鬆地放棄這些更改。

出於某種原因,我發現在TortoiseGit上執行這個有用的操作非常困難。

,我目前使用的解決方法是:

  1. 執行TortoiseGit --> Show log --> Export this revision...
  2. 複製輸出文件到我的本地庫

有沒有更直接的方式爲這個?

我已經試過以下TortoiseGit操作,但他們只是在我的本地庫「興風作浪」,我無法與「標準」提交&推送流程之後繼續:

  • Reset "master" to this...
  • Switch/Checkout to this...
  • Rebase "master" onto this...
  • Revert change by this commit

我發現了一個類似的問題here,但答案暗示了我的TortoiseGit彈出菜單中甚至不可行的選項。

非常感謝您的幫助。

+0

已經有一段時間,因爲我用顛覆,但這裏有一個例子,假設您在提交#1有一個包含A的文件,則在提交#2時將其更改爲B.現在,您恢復到#1,該文件現在是否包含B或A? –

+0

你嘗試過「git checkout」嗎?你說這會造成嚴重破壞,那究竟是什麼意思?但我先前的問題,首先回答,我們會從那裏拿下。 –

+0

@ LasseV.Karlsen:我在TortoiseGit彈出菜單中沒有該選項。 – goodvibration

回答

2
  1. 在提交右鍵單擊,然後Compare with working tree
    enter image description here
  2. 選擇所有文件預計Added者和Rename的,然後右鍵單擊,並Revert to revert xxxxxxx(sha1)
    enter image description here
  3. 對於Added的,你需要刪除他們手動
  4. 對於Renamed的人,你需要手動重命名他們
  5. 回到Changed Files並刷新它,看它是否是No differences found!
    enter image description here
  6. 提交
    enter image description here
  7. 日誌 enter image description here
1

我發現了另一個連擊方式比我面前回答你不用關心Renamedadded這樣(012)

  1. 選擇所有承諾要恢復,並在其上單擊鼠標右鍵,然後單擊Revert changes by these commits

    enter image description here

  2. 將是一個進度對話框

    ​​

  3. 然後,問你是否執行Commit。點擊Commit

    enter image description here

  4. 提交對話框:

    enter image description here
    但是,正如你所看到的,TortoiseGit給出了一個SHA1值,而不是所有承諾要恢復SHA1值。所以你可能想要在那裏添加/修改更多的信息。就像這樣:
    enter image description here

  5. 復歸日誌提交

    enter image description here

相關問題