เริ่มต้นด้วย repo ในสถานะเดิม

ในการลบคอมมิตการผสานและสควอชสาขาเป็นคอมมิตเดียวในเมนไลน์

ใช้คำสั่งเหล่านี้ (แทนที่ 5 และ 1 ด้วย SHAs ของคอมมิตที่เกี่ยวข้อง):
git checkout 5
git reset --soft 1
git commit --amend -m '1 2 3 4 5'
git rebase HEAD master
หากต้องการรักษาการผสานรวม แต่สควอชสาขาจะรวมเป็นหนึ่ง:

ใช้คำสั่งเหล่านี้ (แทนที่ 5, 1 และ C ด้วย SHAs ของคอมมิตที่เกี่ยวข้อง):
git checkout -b tempbranch 5
git reset --soft 1
git commit --amend -m '1 2 3 4 5'
git checkout C
git merge --no-ff tempbranch
git rebase HEAD master
ในการลบคอมมิตการผสานและแทนที่ด้วยคอมมิตแต่ละรายการจากสาขา

เพียงแค่ทำ (แทนที่ 5 ด้วย SHA ของคอมมิตที่เกี่ยวข้อง):
git rebase 5 master
และสุดท้ายเพื่อลบสาขาทั้งหมด

ใช้คำสั่งนี้ (แทนที่ C และ D ด้วย SHAs ของคอมมิตที่เกี่ยวข้อง):
git rebase --onto C D~ master