Skip to content

Teach git add --patch to optionally stash a hunk, or drop it from the worktree without stashing #1828

Open
@dscho

Description

@dscho

Originally requested on the Git mailing list, in a reply Jeff King sketched how this would have been implemented in the Perl version of git add -p.

In the meantime, git add -p is a built-in, therefore it will be slightly more involved.

In particular, while the Perl variant seems to have staged changes immediately, the pure C version reassembles a single patch per file and applies that. The Perl variant is no more, therefore the C version would need to be patched. And there, that the paradigm would have to be extended so that an optional "reassemble-and-stash" or "reassemble-and-discard" step would precede that "reassemble-and-stage" phase.

Not the easiest project, but probably Outreachy/Google Summer of Code-sized.

I have pushed a very rudimentary sketch to my add-p-stash-mode branch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions