我在本地有一个 TortoiseGit 存储库,它也被推送到远程。有 2 个分支 - master(生产版本)和 CodeFirst(开发分支)。
今天我修复了 CodeFirst 分支中的一个小错误。我想将该更改(仅对单个文件进行一次更改)合并到 master。我将本地存储库切换到 master,选择合并,然后选择单个提交。按下 OK 后,master 现在似乎包含 CodeFirst 分支中的所有更改,而不仅仅是我想要的更改。
我如何
a) 撤销错误的合并和提交
b) 重新应用从 CodeFirst 到 master 的单一更改
[This revision is tagged CodeFirst and master in the TortoiseGit log. It is the commit I wanted to merge]
Revision: 7d4c3d30aec8fb8e531331866c091dee8fa94f25
Author: Nikki Locke <[email protected]>
Date: 07/04/2015 18:03:37
Message:
Allow changing both accounts on new transfers.
----
Modified: bin/banking/transfer.html
[This revision is tagged origin/CodeFirst and master in the TortoiseGit log. I did not want to merge it to master!]
Revision: ce94383e46285fb4f2af4dc21f850952ca65f250
Author: Nikki Locke <[email protected]>
Date: 02/04/2015 19:54:23
Message:
Fixed syntax errors in CASE statements
----
Modified: Reports.cs
[Many more revisions made in the CodeFirst branch omitted]
[This revision is tagged origin/master in the TortoiseGit log]
Revision: 68e1dff312b5927df01a9ab7e483f9163324b864
Author: Nikki Locke <[email protected]>
Date: 31/03/2015 19:04:01
Message:
Make Qty input box smaller.
Put some css into invoice print to make it align correctly.
----
Modified: bin/customer/print.html
Modified: bin/default.js
答案1
要“恢复”合并,请打开日志对话框并将分支/当前 HEAD 重置为合并之前的提交(您想要保留)。
实际上,您并不是想合并另一个分支,而是想挑选一个提交。在日志中单击要挑选的提交,然后选择“cherry-pick”。