[DG: Open Forum] GIT add question

Charles Severance csev at umich.edu
Mon Oct 15 12:25:00 PDT 2012


Thanks Dave - great explanation.

On Oct 15, 2012, at 3:14 PM, Dave Ross wrote:

> To answer your first question, yes git add puts the content of that
> file *at that time* into the staging area. If you change it after
> that, it won't be part of the commit, unless you add those additional
> changes. This is really what allows partial commits in git (meaning
> you can have multiple changes in a file and spread them over several
> commits).

Does this mean there are three versions - the one in the repo, the most recent one in the index, and the most current one on disk?

Or is the index a series of versions that I can navigate forward and backwards through.

If I did this:

edit 1
git add
edit 2
git add
edit 3
git add
edit 4
git add

And then wanted what I had after "edit 2" could I get it back?

And then after all that I do a 

git commit 

Would it be one commit with edits 1-4 or would it be four commits, one for each add?   (i.e. do I need to rebase multiple adds, prior to a commit if I want one commit?)

> For packaging up a bunch of commits to make things cleaner to your
> "audience",  Git makes this easy - you can simply squash all the
> commits in your branch prior to merge.
> 
> See: http://ariejan.net/2011/07/05/git-squash-your-latests-commits-into-one

Cool - perfect article - just what I needed.

/Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/openforum/attachments/20121015/8ea38e3e/attachment.html 


More information about the openforum mailing list