All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Sagotsky <sagotsky@gmail.com>
To: git@vger.kernel.org
Subject: Feature request - git add --patch should have an option to discard or drop a hunk Inbox
Date: Thu, 7 Jan 2021 11:43:45 -0500	[thread overview]
Message-ID: <CAJamm=+Z=88G6cH3DRkttGQkrf9tng310+p=4cKiy-GvdCG3zg@mail.gmail.com> (raw)

I frequently make changes to a number of files.  I use `git add -p` to
select a number of changes and wrap them up in a commit.  Then I run
it again to build another commit.  Wash, rinse, repeat.

Sometimes I make a change I don't intend to keep.  Maybe it's a typo,
or some debug code, or my linter does something naughty.  As
described, I have to skip that hunk once per commit I'm building.
Usually this is merely inconvenient, but each pass through `git add
-p` runs the risk of me mistakenly adding unintended changes to my
commit.

I could use `e` to edit away that hunk, but for some odd reason that
feels too tedious.  What I'd really like as a small quality of life
enhancement is the ability to discard a hunk so that it's deleted
immediately and I don't have to skip it again.  `d` is taken, so I
suggest `x` as a shortcut.

Thanks!
Jon

             reply	other threads:[~2021-01-07 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 16:43 Jon Sagotsky [this message]
2021-01-08  9:10 ` Feature request - git add --patch should have an option to discard or drop a hunk Inbox Jeff King
2021-01-08 15:21   ` Johannes Schindelin
2021-01-08 16:15     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJamm=+Z=88G6cH3DRkttGQkrf9tng310+p=4cKiy-GvdCG3zg@mail.gmail.com' \
    --to=sagotsky@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.