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

Re: removing a commit from a branch

From
Jeff King <peff@peff.net>
Date
May 4, 2011, 08:45 UTC
Message-ID
<20110504084502.GC8512@sigill.intra.peff.net>
In-Reply-To
<BANLkTimtpvVRU=1iCbrteyHixaWGuVKDjQ@mail.gmail.com>
On Wed, May 04, 2011 at 10:35:08AM +0200, Gergely Buday wrote:
> I have a problematic commit in a series of commits on a branch. It
> contains adding a large binary file, which I would like to avoid to
> push to our main repository. How can I remove that from the series of
> commits? A command-line solution, please, if possible.

Removing it will involve rewriting history, which can create headaches for people who have built on that history (they will need to rebase their commits on the rewritten history). But if that's OK, then the command you want is filter-branch. See "git help filter-branch"; in particular, the EXAMPLES section contains commands to do exactly what you want.

-Peff
Previous: Gergely BudayNext: Gergely Buday
Message 2 of 8 in “removing a commit from a branch”
  1. Gergely BudayMay 4, 2011
  2. Jeff KingMay 4, 2011
  3. Gergely BudayMay 4, 2011
  4. Peter KreftingMay 4, 2011
  5. Dirk SüsserottMay 4, 2011
  6. Sorry, completely off-topic. I've a mailer problem (was: Re: removing a commit from a branch)Dirk Süsserott, May 4, 2011
  7. Øyvind A. HolmMay 4, 2011
  8. Dirk SüsserottMay 5, 2011

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.