help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Committing only specific hunks in VC


From: Stefan Monnier
Subject: Re: Committing only specific hunks in VC
Date: Tue, 11 Jan 2011 12:28:58 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> I have a bunch of files that have been modified and I'd like to commit
> all of these changes except for one hunk in one of the files.
> How would I do this from Emacs?

For many years, I've had a local patch to do that in VC, but I recently
threw it out, deciding that it deserves to be rewritten based on the
"new" tools available currently, i.e. stash/shelve.

> I've heard that it's possible to stage
> only specific hunks in magit, but I'm using Mercurial.

I haven't used Mercurial enough, but I'd do a "hg shelve" (or "hg
stash" or whatever it's called and if hg doesn't have such
a functionality, I'd do it by hand: "hg diff >shelve1.diff");
Then I'd use C-x v, diff-mode and friends to add/remove changes to get
just the changes I want to commit;
Then "hg commit";
Then "hg unshelve" or "hg unstash" or "patch -p0 <shelve1.diff";
And resolve the potential conflicts, if any.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]