I have a git
history as such:
* aab941c (HEAD -> master) Added ...
| * 2519b79 (participantQueue) Added ...
| * 39c4efb Created ...
|/
* 87b0cf7 Import ...
| * 5569822 (settings) Modified ...
|/
* ee67831 Added ...
* c07902f Added ...
* 7f5ab04 Added ...
* 82be721 Modified from `A` to `B`
* d86702b Modified from `A` to `B`
* 8cad721 Modified from `A` to `B`
* 5db240b Removing ...
I want to squash 8cad721
to 82be721
, and end up with:
* aab941c (HEAD -> master) Added ...
| * 2519b79 (participantQueue) Added ...
| * 39c4efb Created ...
|/
* 87b0cf7 Import ...
| * 5569822 (settings) Modified ...
|/
* ee67831 Added ...
* c07902f Added ...
* 7f5ab04 Added ...
* 82be721 Modified from `A` to `B` (82be721, d86702b squashed into here)
* 5db240b Removing ...
I have tried git rebase -i 5db240b
as suggested in other SO answers, replacing pick
to squash
for d86702b
and 82be721
. This results in the following:
* 4d91ea0 (HEAD -> master) Added ...
* 7040d3c Import ...
* f6c0fb5 Added ...
* 299c918 Added ...
* 58b209f Added ...
* e8b36f7 Modified from `A` to `B`
| * 2519b79 (participantQueue) Added default participant properties to unpaired queue export
| * 39c4efb Created ...
| * 87b0cf7 Import ...
| | * 5569822 (settings) Modified ...
| |/
| * ee67831 Added ...
| * c07902f Added ...
| * 7f5ab04 Added ...
| * 82be721 Modified from `A` to `B`
| * d86702b Modified from `A` to `B`
| * 8cad721 Modified from `A` to `B`
|/
* 5db240b Removing ...
What command should I be using instead?
After implementing the below answer by LeGEC, I have the following:
* 669164c (participantQueue) Added ...
* 5bc13a8 Created ...
| * 6abf940 (settings) Modified ...
| | * 3518be1 (HEAD -> master) Added ...
| |/
|/|
* | 2692632 Import ...
|/
* 810389b Added ...
* 0c85217 Added ...
* 9284cff Added ...
* eee5eef Modified from `A` to `B`
* 5db240b Removing ...
This threw me for a second as it does look different, but one more commit to master
reorders the "trunk" of the git log
output as before.
question from:
https://stackoverflow.com/questions/65906355/squashing-past-git-commits 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…