我在git中有一個私人分支,我一段時間都沒碰過。我想變基它的master
頂部,所以我:git rebase儘可能接近HEAD?
git checkout master
git pull
git checkout my-branch
git rebase master
First, rewinding head to replay your work on top of it...
Applying: a bunch of stuff
Applying: more stuff
Applying: and so on
CONFLICT (content): Merge conflict in src/foo.c
error: Failed to merge in the changes.
哦,不,我不能直接變基到HEAD
!
git rebase --abort # sigh
我最常做的在這一點上是試圖「棘輪」我的分支接近HEAD
成爲可能,通過使用git rebase SHA1
,git rebase SHA2
(其中SHA1,SHA2等上master
),直到我找到最近的成功重組點。
我選擇候選重定點的常用技巧是在每次合併掌握後立即嘗試。
有沒有一個很好的方法來自動化這個過程?
什麼好處,你從基礎重建的SHA1/2得到什麼?您最終必須在主人身上重新綁定,並且您將得到相同的衝突。 –
只需修復衝突和'git rebase --continue'。 – choroba
如果在rebase中成功合併,它們會被應用,並且我在分支上看到的提交(和潛在的衝突)更少。 –