Re: Question about "git commit -a"

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matthieu Moy
Date: Friday, October 5, 2007 - 5:45 am

Andreas Ericsson <ae@op5.se> writes:


That usage is indeed very close to a micro-micro-throwable branch.

Instead of doing:

<hack>
<diff>
<commit>

<hack>
<diff>
<commit>

# Oh, gosh, I didn't want that! | # Yes, _this_ is what I want
$ git reset --hard HEAD^^       | $ git checkout HEAD^^
                                | $ git merge --squash HEAD@{1}
                                  (untested)

You'd do:

<hack>
<diff>
<add>

<hack>
<diff>
<add>

# Oh, gosh, I didn't want that! | # Yes, _this_ is what I want
$ git reset --hard              | $ git commit

The two flows are both similar and different. In the first case, you
can't come back to an arbitrary step within your development, but
since you didn't actually commit, and just ran "add", it's precisely
because you thought this state was not one you wanted to come back to
later. And at the time you commit, you don't have to tell git to
forget about the temporary branch, the succession of "git add" was
just for you, not to keep in history.


Actually, most of the time, I commit only when my index matches the
working tree (i.e. when status shows me only green, with color.status
= auto), so "commit" or "commit -a" don't change the result, but I
validate my own changes with "add", and give the whole thing a
descriptive message with "commit".

-- 
Matthieu
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Question about &quot;git commit -a&quot;, Paolo Ciarrocchi, (Thu Oct 4, 8:38 am)
Re: Question about &quot;git commit -a&quot;, Matthieu Moy, (Thu Oct 4, 8:43 am)
Re: Question about &quot;git commit -a&quot;, Paolo Ciarrocchi, (Thu Oct 4, 8:48 am)
Re: Question about &quot;git commit -a&quot;, Wincent Colaiuta, (Thu Oct 4, 8:58 am)
Re: Question about &quot;git commit -a&quot;, Nguyen Thai Ngoc Duy, (Thu Oct 4, 1:33 pm)
Re: Question about &quot;git commit -a&quot;, Johannes Schindelin, (Thu Oct 4, 2:10 pm)
Re: Question about &quot;git commit -a&quot;, Nguyen Thai Ngoc Duy, (Thu Oct 4, 2:16 pm)
Re: Question about &quot;git commit -a&quot;, Andy Parkins, (Thu Oct 4, 2:25 pm)
Re: Question about &quot;git commit -a&quot;, Shawn O. Pearce, (Thu Oct 4, 2:26 pm)
Re: Question about &quot;git commit -a&quot;, Miles Bader, (Thu Oct 4, 11:04 pm)
Re: Question about &quot;git commit -a&quot;, Paolo Ciarrocchi, (Fri Oct 5, 1:39 am)
Re: Question about &quot;git commit -a&quot;, Andreas Ericsson, (Fri Oct 5, 1:52 am)
Re: Question about &quot;git commit -a&quot;, Paolo Ciarrocchi, (Fri Oct 5, 2:06 am)
Re: Question about &quot;git commit -a&quot;, Andreas Ericsson, (Fri Oct 5, 3:02 am)
Re: Question about &quot;git commit -a&quot;, Matthieu Moy, (Fri Oct 5, 3:11 am)
Re: Question about &quot;git commit -a&quot;, Andreas Ericsson, (Fri Oct 5, 3:14 am)
Re: Question about &quot;git commit -a&quot;, Wincent Colaiuta, (Fri Oct 5, 3:48 am)
Re: Question about &quot;git commit -a&quot;, Matthieu Moy, (Fri Oct 5, 4:35 am)
Re: Question about &quot;git commit -a&quot;, Andreas Ericsson, (Fri Oct 5, 5:17 am)
Re: Question about &quot;git commit -a&quot;, Paolo Ciarrocchi, (Fri Oct 5, 5:19 am)
Re: Question about &quot;git commit -a&quot;, Andreas Ericsson, (Fri Oct 5, 5:23 am)
Re: Question about "git commit -a", Matthieu Moy, (Fri Oct 5, 5:45 am)
Re: Question about &quot;git commit -a&quot;, Kristian , (Fri Oct 5, 8:56 am)
Re: Question about &quot;git commit -a&quot;, Matthieu Moy, (Fri Oct 5, 9:33 am)
Re: Question about &quot;git commit -a&quot;, Marko Macek, (Fri Oct 5, 11:16 am)
Re: Question about &quot;git commit -a&quot;, Dmitry Potapov, (Fri Oct 5, 2:10 pm)
Re: Question about &quot;git commit -a&quot;, Andy Parkins, (Sat Oct 6, 12:43 am)
Re: Question about &quot;git commit -a&quot;, Linus Torvalds, (Sat Oct 6, 9:13 am)
Re: Question about &quot;git commit -a&quot;, Marko Macek, (Sat Oct 6, 11:12 pm)
Re: Question about &quot;git commit -a&quot;, Wincent Colaiuta, (Sun Oct 7, 5:26 am)
Re: Question about &quot;git commit -a&quot;, Dmitry Potapov, (Sun Oct 7, 7:50 am)
Re: Question about &quot;git commit -a&quot;, Johannes Schindelin, (Sun Oct 7, 9:26 am)