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

Re: staging specific lines out of a hunk for a commit

From
Jonathan del Strother <maillist@steelskies.com>
Date
Sep 21, 2010, 11:09 UTC
Message-ID
<AANLkTimOPSbG=VqqReMqbQicYygxbHQsniwS5WDvA1z4@mail.gmail.com>
In-Reply-To
<AANLkTin4U78N_8LV8fCWuinNH9AFeOsRBjnvHM0qt2ZH@mail.gmail.com>
On 21 September 2010 11:40, Graeme Geldenhuys <graemeg.lists@gmail.com> wrote:
Show 15 quoted lines
> Hi,
>
> I know 'git gui' has this cool feature where you can stage one line at
> a time. This is really handy, but also very annoying, if you have a
> large piece of code you want to commit.
>
> eg: I have a single hunk, which can't be split into smaller hunks
> because it is all new code. But that hunk fixes a few bugs, or
> introduces a few new features.
>
> Is there a way to use 'git add -i' or 'git add -p' or 'git gui' and
> tell it to add for example lines 5-20 of the hunk to the index?
> Currently with 'git gui', I have to right click and select 'Stage line
> for commit' 15+ times! :-(
>

If you happen to be on a Mac, gitx allows you to select the lines you're interested in with the mouse and stage them.

Previous: Graeme Geldenhuys
Message 6 of 6 in “staging specific lines out of a hunk for a commit”
  1. Graeme GeldenhuysSep 21, 2010
  2. Bert WesargSep 21, 2010
  3. Graeme GeldenhuysSep 21, 2010
  4. Matthieu MoySep 21, 2010
  5. Graeme GeldenhuysSep 21, 2010
  6. Jonathan del StrotherSep 21, 2010

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.