git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Barkalow <barkalow@iabervon.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Petr Baudis <pasky@suse.cz>,
	Martin Langhoff <martin.langhoff@gmail.com>,
	git@vger.kernel.org
Subject: Re: [FAQ?] Rationale for git's way to manage the index
Date: Wed, 9 May 2007 13:39:55 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0705091322180.18541@iabervon.org> (raw)
In-Reply-To: <alpine.LFD.0.98.0705090825090.4062@woody.linux-foundation.org>

On Wed, 9 May 2007, Linus Torvalds wrote:

> Many people seem to enjoy per-hunk commits, but I seldom do that. Maybe 
> it's just because I'm *so* comfortable with diffs, that when I clean up an 
> ugly sequence of commits, what I do is literally:
> 
>  - I make sure that my ugly sequence of commits is on some temporary 
>    branch, but that the _end_result_ is good and clean (ie I will have 
>    tested the end result fairly well, and made sure that there are no 
>    debug statements etc crud left).
> 
>    I would call this branch something like "target", because the end 
>    result of that branch is what I'm looking for - even if the commits in 
>    the sequence that gets me there are individually ugly!
> 
>  - I just switch back to my starting point (and now I'm usually on 
>    "master"), and do
> 
> 	git diff -R target > diff
> 
>    to create a diff of my current tree (which is initially the starting 
>    point) to the good result.
> 
>  - I actually edit the "diff" file by hand, and edit it down to the part I 
>    actually want to commit as the first in the series. And then I just do 
>    a "git-apply diff" to actually apply that part to my working tree.
> 
>  - I then edit any missing parts in the actual working tree (for example, 
>    if there were mixed hunks that I want to get to in later commits, and I 
>    edited out above, or that I need to partially undo), to do any 
>    finishing touches.
> 
>  - I now have a tree I can compile and test, and has the "first part" of 
>    the journey towards the final "target" state. If compiling/testing 
>    shows that I missed something, I can still fix things, and/or go back 
>    to doing another "git diff -R target" to see if I missed something).
> 
>  - I commit that first case, and repeat the sequence from step 2 (and 
>    at every step, the "diff" file ends up shrinking and shrinking).
> 
> The above sounds like it's a complicated sequence, but it really isn't. 
> Partly because I just am very comfortable with diffs indeed (probably more 
> than most people), but partly because at all times "git diff" works fine 
> to see what I've done, and what the diff to "target" is.

It only sounds like a complicated sequence because you didn't write a 
script to do it...

$ git checkout -b clean origin
$ git-refine target
  (edit the patch in the editor that pops up)
$ git-refine
Test changes and commit
$ make test
...
$ git commit
  (write message)
$ git-refine
  (edit the patch, etc)
  ...
$ git commit
$ git-refine
All done.

I actually wrote it years ago, but I couldn't describe my workflow well 
enough, so I didn't submit it. If everybody seems to be doing the same 
thing, I can submit my script...

	-Daniel
*This .sig left intentionally blank*

  parent reply	other threads:[~2007-05-09 17:40 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-06 16:10 [FAQ?] Rationale for git's way to manage the index Matthieu Moy
2007-05-06 16:51 ` Johannes Schindelin
2007-05-06 17:34   ` Matthieu Moy
2007-05-06 17:43     ` Junio C Hamano
2007-05-09 12:52       ` Petr Baudis
2007-05-09 13:57         ` Johannes Schindelin
2007-05-09 14:24           ` [PATCH] git-commit: Reformat log messages provided on commandline Petr Baudis
2007-05-09 14:59             ` Matthieu Moy
2007-05-09 15:11               ` Petr Baudis
2007-05-09 15:32                 ` Matthieu Moy
2007-05-09 15:01             ` Johannes Schindelin
2007-05-10  0:45             ` Junio C Hamano
2007-05-12  0:25               ` Jakub Narebski
2007-05-06 18:22     ` [FAQ?] Rationale for git's way to manage the index Dana How
2007-05-06 23:42     ` Johannes Schindelin
2007-05-06 17:25 ` Linus Torvalds
2007-05-06 18:23   ` Matthieu Moy
2007-05-06 19:54     ` Linus Torvalds
2007-05-06 22:53     ` Julian Phillips
2007-05-07  6:35       ` Karl Hasselström
2007-05-08  1:41         ` Shawn O. Pearce
2007-05-08  7:15           ` Johannes Sixt
2007-05-08 10:28             ` Karl Hasselström
2007-05-08 12:40               ` J. Bruce Fields
2007-05-08 14:53                 ` Karl Hasselström
2007-05-09  3:45                   ` J. Bruce Fields
2007-05-09  9:40                     ` Johannes Schindelin
2007-05-08  7:37           ` Karl Hasselström
2007-05-08 14:52             ` Shawn O. Pearce
2007-05-06 23:51     ` Johannes Schindelin
2007-05-07  8:02       ` Matthieu Moy
2007-05-07 11:05         ` Johannes Schindelin
2007-05-09 13:07           ` Petr Baudis
2007-05-08  3:16     ` Martin Langhoff
2007-05-08  4:45       ` Linus Torvalds
2007-05-08  5:35         ` Martin Langhoff
2007-05-09 13:41         ` Petr Baudis
2007-05-09 15:52           ` Linus Torvalds
2007-05-09 16:29             ` Carl Worth
2007-05-11  1:28               ` Jakub Narebski
     [not found]                 ` <7vd518gkyo.fsf@assigned-by-dhcp.cox.net>
2007-05-11 11:26                   ` Jakub Narebski
2007-05-11 16:45                     ` Junio C Hamano
2007-05-11 23:06                       ` Jakub Narebski
2007-05-12  0:40                         ` Junio C Hamano
2007-05-12  1:06                           ` Jakub Narebski
2007-05-12  9:35                           ` Jakub Narebski
2007-05-09 16:33             ` Dana How
2007-05-09 17:18               ` J. Bruce Fields
2007-05-09 17:26                 ` Petr Baudis
2007-05-09 17:29                   ` J. Bruce Fields
2007-05-09 17:39             ` Daniel Barkalow [this message]
2007-05-09 18:16               ` Linus Torvalds
2007-05-10  0:31             ` Junio C Hamano
2007-05-10  2:27               ` Steven Grimm
2007-05-10  2:39                 ` Linus Torvalds
2007-05-10  8:00                   ` Matthieu Moy
2007-05-10 22:06               ` Shawn O. Pearce
2007-05-10 22:51                 ` Petr Baudis
2007-05-08 11:07       ` Johannes Schindelin
2007-05-15  1:00         ` David Kågedal
2007-05-15 23:27           ` Johannes Schindelin
2007-05-09 17:18     ` Matthieu Moy
2007-05-07 11:40 ` Guilhem Bonnefille
2007-05-07 12:16   ` Karl Hasselström
2007-05-07 12:36     ` David Kastrup
2007-05-07 12:55   ` Johannes Schindelin
2007-05-07 19:31     ` Junio C Hamano
2007-05-09 13:14     ` Petr Baudis
2007-05-07 22:23   ` Daniel Barkalow
2007-05-15  0:57   ` David Kågedal
2007-05-15  8:29     ` Karl Hasselström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0705091322180.18541@iabervon.org \
    --to=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=martin.langhoff@gmail.com \
    --cc=pasky@suse.cz \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).