Re: How to reorder all commits include the initial commit
2012/3/18 Yi, EungJun <semtlenori@gmail.com>:
> Thanks to David Barr and Jakub Narebski.
> Finally I found the way based on your hints to solve my problem.
>
> $ git checkout -b test --orphan
option -b and --orphan can not be used together.
> $ git format-patch <newroot>^..<newroot> | git am
can not apply patch when there is no root commit
My test for your case:
log of master branch before rebase:
$ git log --oneline
1a91ece commit 3
d7c6dec commit 2
e32542d commit 1rebase:
$ git checkout --orphan new-master
$ rm .git/index
$ git commit --allow-empty -m initial
$ git clean -fd
$ git cherry-pick -n master^
$ git commit --amend -C master^
$ git rebase --root --onto new-master master
$ git branch -d new-mastermaster after rebase:
$ git log --oneline
fbb9fb6 commit 3
56afd5c commit 1
894c42a commit 2-- Jiang Xin