a partial commit
Steve Fink
sphink at gmail.com
Wed Jun 26 17:02:00 UTC 2019
On 6/18/19 9:24 AM, Uwe Brauer wrote:
> Hi
>
> This happens relatively frequently.
>
> I edit say two files, then a problem occurs which I fix.
>
> So I first want to commit the fix, before continuing. If that fix would
> be only in one file (which would only contain changes for that fix)
>
> I would run
>
> hg -I file-fix
>
> And then continue.
>
> If not I could either
>
> hg ci -i
>
> or
>
> hg shelve -i
>
> Which seems just the opposite of each other.
>
> Are they any other tricks I don't know about.
>
> What are your workflows in such situations?
I'm not totally following your example -- you already made changes to 2
files, then you make an additional fix in one of them? But no, it sounds
like you are saying that you edited one file, then made a fix in
another. I'll assume the latter.
If the fix is for the topmost patch in my stack, I would use `hg amend
-i` and select just the file with the fix.
If it applies to a lower one in my stack, I would first try `hg absorb`
to see if it applies it to the right place. If not, I'll do `hg commit
-i` to create a temporary patch, `hg commit` to make a commit with the
rest of the stuff, then `hg histedit` to roll the fix into its
appropriate commit. (Perhaps hg shelve is a better thing to use here for
the "rest of the stuff" commit, but I tend to stick to vanilla
changesets and rely on histedit heavily to reorganize things as needed.
If it feels awkward to have that top commit, I'll `hg uncommit -a` to
take it back out into my working directory.)
If the fix is for a pre-existing issue that is not from my current
stack, I would use `hg commit -i`. I'm unclear on what else you would
want in this case -- you say that you use that, but it sounds like
that's not giving you everything you want? Could you clarify?
More information about the Mercurial
mailing list