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

Re: RFC: Patch editing

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 27, 2007, 11:54 UTC
Message-ID
<Pine.LNX.4.63.0702271247000.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<Pine.LNX.4.64.0702270205540.6485@iabervon.org>
Hi,
On Tue, 27 Feb 2007, Daniel Barkalow wrote:
> For much the same reason, I wrote a script that entirely ignores the 
> intermediate commits in a throw-away head, and lets you trim down the 
> diff between the mainline and your head, and arrange it into a new patch 
> series.

It looks to me like you just start a new branch, get the state of an existing commit *1*, and then "git add -i" your way through that diff.

This is slightly different from my work flow:
- I can have overlapping changes (i.e. one commit fixes something which 
  gets refactored in the next), and
- I try not to touch the code when editing the patch series. Only in the 
  conflicting case, I _have_ to edit it.

The latter means, of course, that the commits in the throwaway branch _must_ be a superset of the commits I want to have in the cleaned up branch. (Meaning that I never commit two unrelated things with the same commit.)

To achieve that, I use my own version of "git add -i" quite often while composing the throwaway branch. For example, when I found a bug with an easy fix, in the middle of something different, and the fix touches a file that is already changed, I only commit the appropriate hunks of that file.

Ciao, Dscho

*1* It is not really as easy as "git diff ..other-branch | git apply", since you would lose valuable information about added files, so you have to be very careful there.

Previous: Daniel BarkalowNext: Daniel Barkalow
Message 8 of 15 in “RFC: Patch editing”
  1. Johannes SchindelinFeb 25, 2007
  2. Peter BaumannFeb 26, 2007
  3. Shawn O. PearceFeb 26, 2007
  4. Johannes SchindelinFeb 26, 2007
  5. Shawn O. PearceFeb 26, 2007
  6. Junio C HamanoFeb 26, 2007
  7. Daniel BarkalowFeb 27, 2007
  8. Johannes SchindelinFeb 27, 2007
  9. Daniel BarkalowFeb 27, 2007
  10. Johannes SchindelinFeb 27, 2007
  11. Daniel BarkalowFeb 27, 2007
  12. Johannes SchindelinFeb 27, 2007
  13. Karl HasselströmFeb 28, 2007
  14. Updated version, was Re: RFC: Patch editingJohannes Schindelin, Mar 1, 2007
  15. Junio C HamanoMar 1, 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.