From: Junio C Hamano Date: Tue, 16 Aug 2011 20:01:41 GMT Subject: Re: [PATCH] update-index: add --swap to swap index and worktree content Message-ID: <7vippxgm6y.fsf@alter.siamese.dyndns.org> In-Reply-To: <1313158058-7684-1-git-send-email-pclouds@gmail.com> Nguyễn Thái Ngọc Duy writes: > What I want is a quick way to modify index content without changing > worktree, then I can continue adding more hunks to the index. Why would you even want to do that? Suppose you want to update hello.c in the index but not in the working tree for whatever reason I do not understand. Presumably you would with this patch do this: edit hello.c git update-index --swap hello.c assuming that the state of hello.c _before_ the edit was pristine. But then after that what would you do? Probably you would commit that untested change, and rebase-i to clean them up later, which is fine. BUT After swapping, the file in the working tree lacks the change you made to the index, so if you keep working on it after the above "swap" in your editor, the next "git add" will revert whatever you did with the first "edit". I think that makes it too error prone and difficult to understand for both new and experienced people. Whatever the expected use case is, it needs to be explained a lot better.