Skip to content

Sub-line (character-level) staging — in scope? #4

Open

Description

@bew

Hello!

I came across your tool while researching partial staging tools for AI agent workflows.
The stable hunk IDs is an interesting design!
I was evaluating whether to build a custom tool for a need I have: staging at character granularity within a single diff line.

Would something like this be in scope for your project?
(ai input interface to be defined.. I have one for my unwritten custom tool, but it's too different from yours for other commands)

A few concrete examples:

Two independent changes on the same line:

-foo(old_arg, debug=True)
+foo(new_arg, debug=False)

I want to stage old_arg → new_arg only.
debug=True → False should stay unstaged.

Partial string change:

-const BASE_URL = "http://localhost:8080/api/v1"
+const BASE_URL = "https://api.prod.example.com/v2"

I want to stage http → https only.
The host and path refactor goes in a separate commit.

The initial approach I had in mind is straightforward.
Produce a hybrid + line that applies only the desired character-level change.
Wrap it in a valid hunk and pipe to git apply --cached.


👉 What do you think about this?

Activity

  1. raine commented on Jun 28, 2026

    @raine
    Owner

    Hmm, I somehow cannot imagine this being very useful. Do you run into this a lot?

  2. bew commented on Jun 28, 2026

    @bew
    Author

    Hello! I wouldn't say 'a lot' but it happens sometimes (every few weeks) when I'm working of multiple changes at once and want to do individual commits/PRs 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions