As far as I know about git, these objects are not deleted. And not only the
file, but also the objects that represent the tree and commit. You can
check this using git fsck --full. This command will find dangling objects
and you can see its content using git cat-file -p <sha1sum>.

If you want to delete these dangling objects, you should use git gc
--prune. It will delete dangling objects that are older than a certain
time. The default value is two weeks, however you can change this value.

I hope that it helped you.

William Seiti Mizuta
Desenvolvedor da Caelum

On Mon, Nov 26, 2012 at 4:07 PM, John McKown

> OK, this is more a question to help me understand git internals than an
> actual problem that I am having. But suppose I create a new branch. "git
> checkout -b newbranch". I am now in the "newbranch" branch. So I create a
> new file in my working directory such as: "date >ldate". I now have ldate
> in my working directory. I do: "git add ldate" and "git commit -m 'added
> ldate to track last date'". The contents of ldate are kept in a git object
> whose name is the sha1sum of the contents. I now decide this is silly. So I
> want to eliminate "newbranch". The simpliest way, not having done a "git
> push" is to just kill it with "git branch master;git branch -D newbranch".
> Now, after this, is the git object for the now non-existent ldate file
> already cleaned up? Or do I need to do something else, such as "git gc",
> "git prune"? I'm pretty sure that the "git gc" is the best bet.
> --


Reply via email to