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

Re: How to split a patch

From
Mike Hommey <mh@glandium.org>
Date
Jan 28, 2008, 10:49 UTC
Message-ID
<20080128104932.GA20586@glandium.org>
In-Reply-To
<7vr6g2teqh.fsf@gitster.siamese.dyndns.org>
On Mon, Jan 28, 2008 at 02:40:38AM -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Yes, and you can do the same with "git add -i".  These tools are
> > not quite nice, as they encourage a wrong workflow of committing
> > what you haven't had as a whole in the work tree.  By
> > definition, you are making untested commits between your base
> > commit (that presumably was tested well) and your final commit
> > (that would also be tested well).
> > ...
> > There is no such tool yet, though.
> > 
> > The splitting you can do with "rebase -i" instead walks
> > forwards.  That also lets you test before you make commits in
> > each step.
> 
> Having said all that, what I tend to do in practice is something
> like this:
(...)

I just git commit the hunks, then git stash the rest of the changes, and if I need some more changes to make the hunks only work, I commit --amend.

Once the commit is stable, I stash apply, resolving conflicts if any arose.
Mike
Previous: Junio C HamanoNext: Wincent Colaiuta
Message 7 of 11 in “How to split a patch”
  1. Paolo CiarrocchiJan 28, 2008
  2. Junio C HamanoJan 28, 2008
  3. Paolo CiarrocchiJan 28, 2008
  4. Matthieu MoyJan 28, 2008
  5. Junio C HamanoJan 28, 2008
  6. Junio C HamanoJan 28, 2008
  7. Mike HommeyJan 28, 2008
  8. Wincent ColaiutaJan 28, 2008
  9. Johannes SchindelinJan 28, 2008
  10. Wincent ColaiutaJan 28, 2008
  11. Boaz HarroshJan 28, 2008

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.