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

Re: request for documentation about branch surgery

From
Andreas Ericsson <ae@op5.se>
Date
Jul 7, 2009, 10:06 UTC
Message-ID
<4A531E30.5040907@op5.se>
In-Reply-To
<200907071151.03567.bruno@clisp.org>
Bruno Haible wrote:
> I said.
> 
> Still, can someone please extend the cited chapter of the user's manual,
Presumably you can. I'll jot down some notes for you though ;-)
> so that it answers these questions?
>   - How do I insert some commits between other commits in a branch?
>                                                        [TODO]
git rebase --interactive (don't do this on published branches).
>   - How do I reorder commits in a branch?              [TODO - mention "git rebase -i"]
git rebase --interactive
>   - How do I cut a branch?                             [TODO]

Define "cut". Possibly "git branch -d" or it's less forgiving sibling "git branch -D", in case the branch to be removed isn't fully merged.

>   - How do I replace a branch tip with the contents of another branch?
>                                                        [TODO]

Easily understandable: git checkout branch git reset --hard otherbranch

The low-level way: git update-ref [-m <reason>] [--no-deref] <full-ref-name> <newvalue>

There are more options to git-update-ref. The man-page lists them all.
>   - How do I reconnect a branch to another branch point?
>                                                        [TODO]

I don't quite understand what you mean by "reconnect", but this might do something along the lines of what you want: git checkout branch-to-connect-to git merge branch-to-be-connected

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Bruno HaibleNext: Junio C Hamano
Message 5 of 10 in “request for documentation about branch surgery”
  1. Bruno HaibleJul 6, 2009
  2. Elijah NewrenJul 7, 2009
  3. Elijah NewrenJul 7, 2009
  4. Bruno HaibleJul 7, 2009
  5. Andreas EricssonJul 7, 2009
  6. Junio C HamanoJul 7, 2009
  7. Bruno HaibleJul 7, 2009
  8. Andreas EricssonJul 7, 2009
  9. Junio C HamanoJul 7, 2009
  10. Daniel BarkalowJul 7, 2009

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.