how to ammend a changeset and push

Dan Villiom Podlaski Christiansen danchr at gmail.com
Mon Nov 18 18:15:33 UTC 2024


You really should look into the `evolve` extension; not only is it 
pretty awesome in itself, but it also simplifies editing history when 
using hg-git a good deal.

You can also simply enable `obsolete` support locally, I believe; it 
should have the same effect:

   [experimental]
   evolution = yes

In the default setup, any history modification consists of adding new 
commits and stripping the old ones. There's nothing telling hg-git of 
this fact, so you have to invoke `hg git-cleanup` after each modification.

If you do enable obsolete/evolution though, the old commits will stick 
around, and be shown with the old Git pseudo-tags pointing to them. You 
can then do a force push to update them.

(Not sure why evolution is still experimental at this point; it's been 
around for years, and seems to work very well in practice ¯\_(ツ)_/¯)

Or just the short version: Run `hg git-cleanup` prior to pushing.

- Dan

On 18/10/2024 11.03, 'Uwe Brauer' via hg-git wrote:
> Hi
>
> Here is my supposed workflow (for a fork in github)
>
>      - Fork the repository
>
>      - clone it to you machine
>
>      - commit a change on a new branch (bookmark)
>
>      - push
>
>      - changes that are suggested by the maintainer should be done by amending the changes to the commit that was already pushed!!!
>
>      - and then push again
>
> I tried that using the latest hg-git vanilla (so no fancy stuff like named branches or topics).
> I tried it with or without evolve, for example without evolve something like
> hg commit -m "matlab-mode: update url to github, modify list of files" --amend
>
> But then the push command returned
>
> hg push
> pushing to git+ssh://git@github.com:ouboub/melpa-matlab.git
> Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
> searching for changes
> abort: unknown revision 'd7fc2eeb5a0aede72bb7f221d901656822a98c24'
>
>
> I cannot use hg histedit because the changeset is already public.
>
>
> Any idea how to do this?
>
> Or is this beyond hg-git?
>
> Regards
>
> Uwe
>
>
>


More information about the Mercurial mailing list