Reputation: 2041
I would like to simplify this Git history, which contains several Git branches:
* 83bc4db
|\
| * 66c64f9
| * 32c1a93
| * 8b5fd0c
| * 501454e
| * b316bac
| |\
| * | 6d8f409
| * | ca9747a
| * | fa37e88
| |\ \
| * | | 97ce58e
* | | | e56b9df
* | | | 33441b7
* | | | e5b2606
* | | | dbb039e
* | | | 68f3082
* | | | 17774ea
* | | | 1945fbd
| |_|/
|/| |
* | | 8c3b38d
| |/
|/|
* | d0aaef1
|/
* 08273d5
* 2f8652a
* 0e3d8df
into a single commit:
* XXXXXXX
* 08273d5
* 2f8652a
* 0e3d8df
I tried to rebase with:
git rebase -i 08273d5
Then modify the git-rebase-todo like this:
pick d0aaef1
squash 8c3b38d
squash 1945fbd
squash 17774ea
squash 68f3082
squash dbb039e
squash e5b2606
squash 33441b7
squash e56b9df
squash 97ce58e
squash ca9747a
squash 6d8f409
squash 501454e
squash 8b5fd0c
squash 32c1a93
squash 66c64f9
Git says:
error: could not apply 97ce58e... merge done
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".
Could not apply 97ce58e... merge done
What are the Git command(s) to issue?
Upvotes: 2
Views: 687
Reputation: 20656
The easiest way to do this is to check out commit 08273d5, then check out all the files from 83bc4db into the working directory, then create a new branch and commit the changes, i.e. (from the top-level directory)
git checkout 08273d5
git checkout 83bc4db -- .
git checkout -b newbranchname
git commit -m "Some message"
Upvotes: 2