From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: "Kristian Høgsberg" <krh@redhat.com>
Cc: Andreas Ericsson <ae@op5.se>,
Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
Wincent Colaiuta <win@wincent.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Question about "git commit -a"
Date: Fri, 05 Oct 2007 18:33:38 +0200 [thread overview]
Message-ID: <vpq641led25.fsf@bauges.imag.fr> (raw)
In-Reply-To: <1191599763.7117.18.camel@hinata.boston.redhat.com> ("Kristian Høgsberg"'s message of "Fri\, 05 Oct 2007 11\:56\:03 -0400")
Kristian Høgsberg <krh@redhat.com> writes:
> I understand why people like staging and commit without -a, seeing how
> it's faster and all,
Actually, commit without -a is not much faster, since it runs "status"
internally, to show it to the user when launching the editor. So, it
still checks for changes in the working tree.
> but I have a serious problem with this practice that I haven't seen
> brought up on the list. How do you know what you commit actually
> works or even compiles?
That's a general problem with partial commits, and that's why I
personnaly don't like partial commits in general ($scm commit file1
file2 has the same problem, \forall $scm).
To me, the right approach to partial commit is to stash the unwanted
changes, test, commit, and unstash.
(side note: it would be cool to have a "git stash --unstaged" command,
to put the unstaged changes aside, and match the tree to the index. A
good approximation for that is:
$ git stash # put all aside
$ git reset --mixed stash^2 # get back what the index used to be
$ git add -u # and put it back into the index.
)
*But*, the cool thing with git is that you can view rather easily not
only what you're about to commit (git diff --cached), but also what
you're about _not_ to commit (git diff). So, if the unstaged changes
are trivial enough, it can be OK (for example, Linus changes the linux
version in a Makefile a few commits before the release, and doesn't
add it to the index, to keep it as a reminder).
But I agree with your that splitting a huge patch into smaller ones
using just the index is bad practice, except if you intend to come
back to each commit and test it later.
--
Matthieu
next prev parent reply other threads:[~2007-10-05 16:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-04 15:38 Question about "git commit -a" Paolo Ciarrocchi
2007-10-04 15:43 ` Matthieu Moy
2007-10-04 15:48 ` Paolo Ciarrocchi
2007-10-04 15:58 ` Wincent Colaiuta
2007-10-04 20:33 ` Nguyen Thai Ngoc Duy
2007-10-04 21:10 ` Johannes Schindelin
2007-10-04 21:16 ` Nguyen Thai Ngoc Duy
2007-10-04 21:26 ` Shawn O. Pearce
2007-10-05 8:39 ` Paolo Ciarrocchi
2007-10-05 8:52 ` Andreas Ericsson
2007-10-05 9:06 ` Paolo Ciarrocchi
2007-10-05 10:02 ` Andreas Ericsson
2007-10-05 10:11 ` Matthieu Moy
2007-10-05 10:14 ` Andreas Ericsson
2007-10-05 11:35 ` Matthieu Moy
2007-10-05 12:17 ` Andreas Ericsson
2007-10-05 12:19 ` Paolo Ciarrocchi
2007-10-05 12:23 ` Andreas Ericsson
2007-10-05 12:45 ` Matthieu Moy
2007-10-05 15:56 ` Kristian Høgsberg
2007-10-05 16:33 ` Matthieu Moy [this message]
2007-10-05 18:16 ` Marko Macek
2007-10-06 7:43 ` Andy Parkins
2007-10-06 16:13 ` Linus Torvalds
2007-10-07 12:26 ` Wincent Colaiuta
2007-10-05 21:10 ` Dmitry Potapov
2007-10-07 6:12 ` Marko Macek
2007-10-07 14:50 ` Dmitry Potapov
2007-10-07 16:26 ` Johannes Schindelin
2007-10-05 10:48 ` Wincent Colaiuta
2007-10-04 21:25 ` Andy Parkins
2007-10-05 6:04 ` Miles Bader
2007-10-04 22:34 ` David Soria
2007-10-04 23:03 ` Alex Riesen
2007-10-04 23:19 ` Johannes Schindelin
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=vpq641led25.fsf@bauges.imag.fr \
--to=matthieu.moy@imag.fr \
--cc=Johannes.Schindelin@gmx.de \
--cc=ae@op5.se \
--cc=git@vger.kernel.org \
--cc=krh@redhat.com \
--cc=paolo.ciarrocchi@gmail.com \
--cc=pclouds@gmail.com \
--cc=win@wincent.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.