Re: How do I clear the directory cache

From: Junio C Hamano <junkio@cox.net>
Date: 2005-10-21 14:09:30
eschvoca <eschvoca@gmail.com> writes:

> Yes, ... is what I want (how do I do this with pure git?).

How do you do *what* with pure git is something not clear to me,
so let me try to rephrase you and see if I understood what you
want correctly, in pure git terms:

 0. Your last commit (.git/HEAD), your index file (.git/index)
    and the files in your working tree are in sync to begin
    with.

 1. Then you do random changes in the working tree (add, modify,
    remove) and do git-update-index on them without making a
    commit.  If your index file is fully in sync with your
    working tree, git-diff-files would say nothing after this.
    If you did git-update-index on some but not all, then
    git-diff-files would report unrecorded changes.

 2. But you want to revert these changes to the index file.  By
    "clearing the directory cache", you mean you want the index
    file to have what it had in step 0, but you want to keep
    what is on the filesystem intact.

If that is what you want, then:

	$ git-read-tree HEAD
        $ git-update-index --refresh >/dev/null

would reset the index to the tree recorded in your last commit.
You can see that

	$ git diff --name-status --cached HEAD

does not report any difference between HEAD and your index, while

	$ git diff --name-status

shows the differences between your index and your working tree.

HOWEVER, the index file does not record "intent to add", so you
would not see files you added in step 1. mentioned in the output
of the last command.



-
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
Received on Fri Oct 21 14:10:06 2005

This archive was generated by hypermail 2.1.8 : 2005-10-21 14:10:10 EST