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

Re: What's the best method between merging and rebasing ?

From
XMXavier Maillard <zedek@gnu.org>
Date
Mar 12, 2007, 19:14 UTC
Message-ID
<200703121914.l2CJEqW0031669@localhost.localdomain>
In-Reply-To
<20070312173727.GC30489@mad.intersec.eu>
Hi,
   From: Pierre Habouzit <madcoder@debian.org>
   On Mon, Mar 12, 2007 at 05:34:55PM +0100, Xavier Maillard wrote:
   > So it seems to be cherry-picks + rebase master on new HEAD but I
   > am not sure at how things are doing :)
     okay then I got this right, you don't want to rebase master on new
   HEAD because you would keep the commits you don't want (I guess). What
     you start from:
   orig master -> A -> B -> C (master)
	       \
		-> D -> E -> F topic
     let's say you want to keep A and C from master. here is what I'd do:
     $ git checkout topic     # topic will be the new master
     $ git cherry-pick A C    # we want to keep A and C
Got it for this one :)
     we now have:
   orig master -> A -> B -> C  (master)
	       \
		-> D -> E -> F -> A' -> C' (topic)
     $ git branch -D master

For historical reasons, I have to keep my master around so I won't delete it completely. Maybe there is a way to tell that a branch is considered "dead" thus indicating there won't be any new developement onto it. I will check this.

As I have been told privately, what I want in reality is a reset of master onto my new HEAD.

I think I have misunderstood reset behaviour.
So this is how I end up now (from my new master branch):

$ git cherry-pick <commits> $ git rebase master~NUM $ git reset master HEAD

There I would need something to tell old master is dead but it is optionnal (a single tag will do that).

Does that make sense for you ?
Regards,

P.S: I have problems reading your posts, my mail buffer is full of =20 here and there

-- 
Xavier
Previous: Pierre HabouzitNext: Pierre Habouzit
Message 7 of 8 in “What's the best method between merging and rebasing ?”
  1. Xavier MaillardMar 12, 2007
  2. Pierre HabouzitMar 12, 2007
  3. Xavier MaillardMar 12, 2007
  4. Johannes SixtMar 12, 2007
  5. Pierre HabouzitMar 12, 2007
  6. Pierre HabouzitMar 12, 2007
  7. Xavier MaillardMar 12, 2007
  8. Pierre HabouzitMar 12, 2007

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.