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

Re: new git-diff switch to eliminate leading "+" and "-" characters

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 17, 2017, 14:53 UTC
Message-ID
<CACsJy8CTL1GUreqNVBYyu2EqqdiUxj-dOOE9=Rr0ivK6-7yKjw@mail.gmail.com>
In-Reply-To
<2C8817BDA27E034F8E9A669458E375EF11886C5A@APSWP0428.ms.ds.uhc.com>

On Tue, Feb 14, 2017 at 6:01 AM, Vanderhoof, Tzadik <tzadik.vanderhoof@optum360.com> wrote:

> The output of git-diff includes lines beginning with "+" and "-" to indicate added and deleted lines.  A somewhat common task (at least for me) is to want to copy output from a "diff" (usually the deleted lines) and paste it back into my code.
>
> This is quite inconvenient because of the leading "+" and "-" characters.  I know there are shell and IDE / editor workarounds but it would be nice if there was a switch to git-diff to make it leave out those characters, especially since "--color" kind of makes those leading characters obsolete.

Color wouldn't show you new/old empty lines though (unless you use different background color, but I doubt that looks readable).

> Would it make sense to develop such a switch or has there been work on that already?

I face this "problem" every day, but most editors nowadays have block-based editing that would allow you to remove a column of "+/-" easily. At least it has not bothered me to think of improving it.

-- 
Duy
Previous: Vanderhoof, TzadikNext: Vanderhoof, Tzadik
Message 2 of 5 in “new git-diff switch to eliminate leading "+" and "-" characters”
  1. Vanderhoof, TzadikFeb 13, 2017
  2. Duy NguyenFeb 17, 2017
  3. Vanderhoof, TzadikFeb 17, 2017
  4. Vanderhoof, TzadikFeb 17, 2017
  5. Junio C HamanoFeb 19, 2017

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.