說我這樣做如下操作:如何在恢復後提交相同的提交,同時保留提交信息?
git init
touch initial && git add initial && git commit -m "Initial commit"
git checkout -b A
touch test_1 && git add . && git commit -m "Commiting test 1" NORMAL
touch test_2 && git add . && git commit -m "Commiting test 2" NORMAL
git checkout master
git merge --no-ff A
git revert -m 1 head
現在,恢復這些提交,變化的東西后,我決定,我再次想這些提交。我不能再做git merge A
,因爲那些提交已經在分支中。
我寧願不做git revert head
,因爲當有人跑git blame
時,他們會看到Revert "Revert "Merge branch 'A'""
這不是特別有用。所以我想要保留原始提交的提交消息/正文。
我的破解是在A
上運行git rebase,並稍微修改了第一次提交的消息,因此提交的哈希值已更新,我可以再次合併,但必須有更好的方法來完成同樣的事情。
我寧願不恢復恢復(請參閱問題爲什麼)。你能更具體地說明我將如何使用櫻桃挑選?可以肯定的是,我不能做'git cherry-pick master ... A',因爲最後一次提交是櫻桃挑選不喜歡的合併。 –
我已經添加了修補程序選項,也許您可以使用它在您選擇的提交之間創建一個修補程序。 – hurturk