git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Baumann <waste.manager@gmx.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Benoit SIGOURE <tsuna@lrde.epita.fr>,
	Alex Riesen <raa.lkml@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	git list <git@vger.kernel.org>
Subject: Re: How to remove a specific hunk
Date: Wed, 31 Oct 2007 13:00:11 +0100	[thread overview]
Message-ID: <20071031120011.GI4435@xp.machine.xx> (raw)
In-Reply-To: <Pine.LNX.4.64.0710311104450.4362@racer.site>


spearce Cc'ed, because this seems like a nice feature to add to git-gui
In no way should this imply that YOU have to implement this!


On Wed, Oct 31, 2007 at 11:06:18AM +0000, Johannes Schindelin wrote:
> Hi,
> 
> On Wed, 31 Oct 2007, Benoit SIGOURE wrote:
> 
> > On Oct 26, 2007, at 9:20 PM, Alex Riesen wrote:
> > 
> > > Pascal Obry, Fri, Oct 26, 2007 17:10:38 +0200:
> > > > 
> > > > Before committing sometimes I want to remove a specific hunk. Say in
> > > > file a.txt I have in the diff 3 hunks, I want to revert/delete/remove
> > > > the second one. Is there a way to do that ?
> > > 
> > > Take a look at git-gui. Try right-clicking in the diff pane at the
> > > bottom.
> > 
> > This only allows you to stage a given hunk, not to remove one.  Right 
> > now I'm in a situation where I need to remove a specific hunk to compile 
> > and it's sad that git-gui doesn't provide an option so that you can 
> > right-click -> revert hunk.
> 
> You have seen that there are two different file lists, "staged changes" 
> and "unstaged changes", right?  AFAIK if you click on the file in "staged 
> changes", you can find the staged hunk and then remove it from the staged 
> area.
> 
> "Revert hunk" would not make any sense, since the hunk disappears once you 
> staged/unstaged it.
> 

On the other hand, something like this would allow you to remove bogus
hunks like debug statements you want to lose, because you tested it and
all works now.

Now you first have to stage all the things you want to keep, and then
select "Commit->Revert Changes" in the menu to remove a hunk forever which
is a little clumsy if you have many hunks and just want to remove one of
them. Seems like a nice feature to add to git gui if you throw in an extra
Yes-No question for the user IFF he realy wants to remove the hunk forever.

-Peter

      parent reply	other threads:[~2007-10-31 12:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 15:10 How to remove a specific hunk Pascal Obry
2007-10-26 15:28 ` Andreas Ericsson
2007-10-26 15:38   ` Pascal Obry
2007-10-26 17:03     ` Benoit SIGOURE
2007-10-26 18:19       ` Johannes Schindelin
2007-10-26 21:59     ` Olivier Ramonat
2007-10-26 16:42   ` Jeff King
2007-10-26 16:49     ` Jeff King
2007-10-29  7:03       ` Miles Bader
2007-10-26 19:20 ` Alex Riesen
2007-10-31 10:10   ` Benoit SIGOURE
2007-10-31 11:06     ` Johannes Schindelin
2007-10-31 11:56       ` Florian Weimer
2007-10-31 12:24         ` Pascal Obry
2007-10-31 12:00       ` Peter Baumann [this message]

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=20071031120011.GI4435@xp.machine.xx \
    --to=waste.manager@gmx.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    --cc=spearce@spearce.org \
    --cc=tsuna@lrde.epita.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).