git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com>
To: "Andreas Ericsson" <ae@op5.se>
Cc: "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, 5 Oct 2007 14:19:02 +0200	[thread overview]
Message-ID: <4d8e3fd30710050519k7a3db02dk5ba9750fd8e9705f@mail.gmail.com> (raw)
In-Reply-To: <47060BB3.3030208@op5.se>

On 10/5/07, Andreas Ericsson <ae@op5.se> wrote:
[...]
> As for the "git commit should default to -a" discussion, I think it's pretty
> clear where I stand ;-)

Fair enough.

Another try to have an easy explanation of how the staging area works:

paolo@paolo-desktop:~/HowIndexWorks$ ls
A  B  C  D  E  F  G

Now I edit A,B,C,D and E:

$ echo A >> A
$ echo B >> B
$ echo C >> C
$ echo D >> D
$ echo E >> E

I now realize want to only commit the changes I did to A,B,C,D.
First step is to place A,B,C and D into the staging area:
$ git add A B C D

Now I can commit:
$ git commitpaolo@paolo-desktop:~/HowIndexWorks$ git commit
Created commit 16032dc: I modified A,B,C and D
 4 files changed, 4 insertions(+), 0 deletions(-)

It's now time to work on F and G:
$ echo F >> F
$ echo G >> G

Current status is:
paolo@paolo-desktop:~/HowIndexWorks$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   E
#       modified:   F
#       modified:   G

Instead of adding E,F and G to the staging are and then commit them in
two steps I can using a single command:
$ git commit E F G (in this case it's equivalent to git commit -a)

paolo@paolo-desktop:~/HowIndexWorks$ git commit E F G
Created commit 69ec8be: I modified E, F and G
 3 files changed, 3 insertions(+), 0 deletions(-)

status now is:
paolo@paolo-desktop:~/HowIndexWorks$ git status
# On branch master
nothing to commit (working directory clean)

Regards,
-- 
Paolo
http://paolo.ciarrocchi.googlepages.com/

  parent reply	other threads:[~2007-10-05 12:19 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 [this message]
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
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=4d8e3fd30710050519k7a3db02dk5ba9750fd8e9705f@mail.gmail.com \
    --to=paolo.ciarrocchi@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    --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 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).