---- Original Message -----
From: Sharan Basappa
To: Git for human beings
Sent: Saturday, August 13, 2016 8:59 AM
Subject: [git-users] Git add
I would like to know the impact of doing "git add"
I assume that git add basically adds a new glob object entry for the file.
Once a commit is done then the glob entry gets linked to commit object
(through the tree object).
However, what happens in the following case?
A file is added using git add but no commit is done.
After additional modification, the file is added again.
A commit is done at this point.
I assume that commit object will now point to the latest file glob object.
The first glob entry is sort of an orphan. Is this correct?
if this is the case, are these files ever removed by git automatically?
Thanks a lot ...
Your assumption is essentially correct. at each 'git add' you get new blobs
added to the local repository, and your index gets updated. if you edit and
re-add the file the new blob gets added and the index entry gets updated and
the old blob is left orphaned. Evenetually the garbage collection (when it
runs, either automatically or manually 'git gc <options>')) will remove such
orphaned blobs (and tree and commits if they too are fully orphaned) as long
as they are 'too old'.
You can use 'git fsck' to get a list "lost and found" objects that have yet to
be removed, so you can always (within the time limits - 2 weeks?) get your
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.