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

Re: Git (svn) merge - but ignore certain commits?

From
PHPeter Harris <git@peter.is-a-geek.org>
Date
Dec 28, 2008, 00:17 UTC
Message-ID
<eaa105840812271617n74406517x3335a05d224f5e0@mail.gmail.com>
In-Reply-To
<49562749.9060705@sneakemail.com>
On Sat, Dec 27, 2008 at 8:02 AM, "Peter Valdemar Mørch (Lists)" wrote:
Show 7 quoted lines
>
> * And now the trick: "git merge" "gitnewbranch" back to master. But I want
> to avoid the "git revert" of the few commits that weren't ready yet.
>
> * "git svn dcommit" master to get the new functionality into svn trunk.
>
> How do I "git merge" all of "gitnewbranch" except the reverts?

"git rebase -i trunk" after you "git merge". Delete the lines that contain the will-be-reverted commits and the revert commits. Actually, skip the reverts in the first place to save time.

Normally I wouldn't suggest it, since it will throw away your merge, but "git svn dcommit" does an implicit rebase anyway, so you will lose nothing.

> Is there a way to "git merge gitnewbranch" excluding the reverts, just the
> "new functionality", so the log of master doesn't even mention the reverts
> and so "git svn rebase" and "git svn dcommit" work properly?

If your branch is so ugly that you want to toss many of the commits anyway, maybe "git merge --squash" is what you are looking for? Or maybe you want to "git rebase -i" before merging?

> How do I do this "properly"?

Use many short-lived feature branches, not few long-lived generic "development" branches. Merge-and-delete is easier than herding reverts.

Peter Harris
Previous: Peter Valdemar Mørch (Lists)Next: Peter Valdemar Mørch (Lists)
Message 2 of 6 in “Git (svn) merge - but ignore certain commits?”
  1. Peter Valdemar Mørch (Lists)Dec 27, 2008
  2. Peter HarrisDec 28, 2008
  3. Peter Valdemar Mørch (Lists)Jan 8, 2009
  4. Peter HarrisJan 8, 2009
  5. Peter Valdemar Mørch (Lists)Jan 8, 2009
  6. Peter HarrisJan 8, 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.