Re: [PATCH] git-add: introduce --edit (to edit the diff vs. the index)
- From
Ping Yin <pkufranky@gmail.com>
- Date
- Apr 10, 2009, 02:03 UTC
- Message-ID
- <46dff0320904091903p57df51c8ice90648ab7a4baa6@mail.gmail.com>
- In-Reply-To
- <46dff0320904091843p3e034647j3c78506b4d0c2b4@mail.gmail.com>
On Fri, Apr 10, 2009 at 9:43 AM, Ping Yin <pkufranky@gmail.com> wrote:
> How about this? > 'add --edit=patch' to edit the patch and "add --edit=index" to edit the index >
One usecase for edit index
After a big change in foo.c in the worktree, you find a typo in foo.c. You want to fix the typo first before commit the big change. But the change is so big that you can't just fix the typo in worktree foo.c and then use "add -p" to pick the typo fix first.
So you can
git stash fix typo and commit git stash apply and resolve the conflict
With 'add --edit=patch', you can git add --edit=patch foo.c
an editor is fired up with the foo.c in index and worktree open side by side. And you can fix the typo in both index and worktree file. When exiting the editor, the index file is modified, and no conflict to resolve.