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

Re: [PATCH v2] git checkout -b: unparent the new branch with -o

From
Erick Mattos <erick.mattos@gmail.com>
Date
Mar 14, 2010, 21:58 UTC
Message-ID
<55bacdd31003141458y3dfa3734i664b61e69dd50436@mail.gmail.com>
In-Reply-To
<55bacdd31003141346t408c276ak507b7c289cf17679@mail.gmail.com>

Resending orphan branch 'cheat sheet' again. Gmail screwed it in previous email. See this using a fixed font:

Branch_A
|
You realize that you need a new empty branch.
|
Is the work tree clean?
|               |
Yes             No
|               |
git clean -ob Branch_B -------Undo?-------Was the work tree clean before?
|                                                 |      |
|                                                 Yes    No
|                                                 |      |
|                                                 |      git add .
|                                                 |      git commit -m temp
|                                                 |      |
|                                                 +------+ git
checkout Branch_A -f
|                                                        |
|                                                        git merge
--squash Branch_B
Do you want to use anything from the work tree?          |
|               |                                        git reset
Yes             No                                       git branch -D Branch_B
|               |
|               git clean -df
|               |
Change the work tree the way you want it to be.
|
git add .
git commit
|
That is it!
Previous: Erick Mattos
Message 17 of 17 in “git checkout -b: unparent the new branch with -o”
  1. git checkout -b: unparent the new branch with -oErick Mattos, Mar 9, 2010
  2. Junio C HamanoMar 12, 2010
  3. Bert WesargMar 12, 2010
  4. David KågedalApr 27, 2010
  5. Erick MattosMar 12, 2010
  6. Junio C HamanoMar 13, 2010
  7. Junio C HamanoMar 13, 2010
  8. Erick MattosMar 14, 2010
  9. Junio C HamanoMar 15, 2010
  10. Erick MattosMar 16, 2010
  11. Jakub NarebskiMar 13, 2010
  12. Junio C HamanoMar 13, 2010
  13. Erick MattosMar 14, 2010
  14. Junio C HamanoMar 15, 2010
  15. Erick MattosMar 16, 2010
  16. Erick MattosMar 14, 2010
  17. Erick MattosMar 14, 2010

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.