git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.

Previous: Ping YinNext: Johannes Schindelin
Message 5 of 11 in “git-add: introduce --edit (to edit the diff vs. the index)”
  1. git-add: introduce --edit (to edit the diff vs. the index)Johannes Schindelin, Apr 8, 2009
  2. Sverre RabbelierApr 8, 2009
  3. Ping YinApr 9, 2009
  4. Ping YinApr 10, 2009
  5. Ping YinApr 10, 2009
  6. Johannes SchindelinApr 10, 2009
  7. Sverre RabbelierApr 10, 2009
  8. Johannes SchindelinApr 13, 2009
  9. Sverre RabbelierApr 13, 2009
  10. Ping YinApr 11, 2009
  11. Johannes SchindelinApr 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.