git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to reorder all commits include the initial commit

From
Jiang Xin <worldhello.net@gmail.com>
Date
Mar 18, 2012, 02:58 UTC
Message-ID
<CANYiYbGbJxZPOAN9twBPZoD318eA_CLcsVzcFuoHrc32+e96FQ@mail.gmail.com>
In-Reply-To
<CAFT+Tg9UGdBxj5-DTpxDJRVgvBCnmkmgm6nzVek0KeELgsNneQ@mail.gmail.com>
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 1
rebase:
    $ 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-master
master after rebase:
    $ git log --oneline
    fbb9fb6 commit 3
    56afd5c commit 1
    894c42a commit 2

-- Jiang Xin

Previous: Yi, EungJunNext: Yi, EungJun
Message 5 of 6 in “How to reorder all commits include the initial commit”
  1. 이응준Mar 17, 2012
  2. David BarrMar 17, 2012
  3. Jakub NarebskiMar 17, 2012
  4. Yi, EungJunMar 17, 2012
  5. Jiang XinMar 18, 2012
  6. Yi, EungJunMar 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.