How to squash mercurial revisions with multiple descendent headsHow can I undo git reset --hard HEAD~1?Git workflow and rebase vs merge questionsHow to change the author and committer name and e-mail of multiple commits in Git?Mercurial for Beginners: The Definitive Practical GuideWith Mercurial, how can I “compress” a series of changesets into one before pushing?How to edit Mercurial commit message after branching?Mercurial: how to amend the last commit?What to do instead of squashing commits in MercurialMercurial (hg) equivalent of git reset (--mixed or --soft)How Can Stripped Changesets Be Recovered

Sleepy tired vs physically tired

How to reclaim personal item I've lent to the office without burning bridges?

Do I need to be legally qualified to install a Hive smart thermostat?

Motorcyle Chain needs to be cleaned every time you lube it?

Is it possible that Curiosity measured its own methane or failed doing the spectrometry?

How did Captain Marvel do this without dying?

Shipped package arrived - didn't order, possible scam?

How can a ban from entering the US be lifted?

In the Seventh Seal why does Death let the chess game happen?

Taking advantage when the HR forgets to communicate the rules

What is the shape of the upper boundary of water hitting a screen?

Way to see all encrypted fields in Salesforce?

How can select a specific triangle in my Delaunay mesh?

What causes a fastener to lock?

What are some bad ways to subvert tropes?

Is there a standard definition of the "stall" phenomena?

What do you call the angle of the direction of an airplane?

How can I effectively map a multi-level dungeon?

Why weren't Gemini capsules given names?

How to deal with a Murder Hobo Paladin?

soda water first stored in refrigerator and then outside

Why did moving the mouse cursor cause Windows 95 to run more quickly?

How to supply water to a coastal desert town with no rain and no freshwater aquifers?

How frequently do Russian people still refer to others by their patronymic (отчество)?



How to squash mercurial revisions with multiple descendent heads


How can I undo git reset --hard HEAD~1?Git workflow and rebase vs merge questionsHow to change the author and committer name and e-mail of multiple commits in Git?Mercurial for Beginners: The Definitive Practical GuideWith Mercurial, how can I “compress” a series of changesets into one before pushing?How to edit Mercurial commit message after branching?Mercurial: how to amend the last commit?What to do instead of squashing commits in MercurialMercurial (hg) equivalent of git reset (--mixed or --soft)How Can Stripped Changesets Be Recovered






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I am trying to clean up some local (draft) mercurial history before I push to our master repository. One step that I'd like to take is to squash / roll together a "Fixup" changeset into its parent. My history looks like this:



o [draft] 14 X
|
| o [draft] 13 Y
|/
o [draft] 12 Fixup
|
o [draft] 11 Thing to Fix
|
o [draft] 10 Z
|
~


When done, it should look like this:



o [draft] 13 X
|
| o [draft] 12 Y
|/
o [draft] 11 Thing to Fix with Fixup
|
o [draft] 10 Z
|
~


Obviously rolling two commits together shouldn't create any conflicts, since the code of the descendants is untouched. However, I can't find a way to get histedit to allow me to edit that far back in my history, since it needs to edit "A changeset together with all its descendants."



Is this edit possible? How should it be done?










share|improve this question

















  • 1





    Are you using the mercurial Evolve extension?

    – Boris Feld
    Mar 26 at 8:21











  • I'm not. We've got a few repos at work where people have experimented with it, but it's caused as many problems as it's solved.

    – geppettodivacin
    Mar 26 at 12:20











  • BTW if you find something shorter than 4 steps (hg graft + hg histedit + hg rebase twice as outlined in my answer) I'd be curious to know what it is.

    – torek
    Mar 26 at 23:27











  • @geppettodivacin I would be interested to hear about your problems with Evolve as a Evolve core contributor. With evolve, it would be two commands, hg fold -r 11+12 to squash the two commits. Then` hg evolve --all` will automatically rebase X and Y for you.

    – Boris Feld
    Mar 27 at 8:32











  • @BorisFeld This would be great as an answer if you expanded it. I can't use it but future searchers could.

    – geppettodivacin
    Mar 27 at 12:03

















2















I am trying to clean up some local (draft) mercurial history before I push to our master repository. One step that I'd like to take is to squash / roll together a "Fixup" changeset into its parent. My history looks like this:



o [draft] 14 X
|
| o [draft] 13 Y
|/
o [draft] 12 Fixup
|
o [draft] 11 Thing to Fix
|
o [draft] 10 Z
|
~


When done, it should look like this:



o [draft] 13 X
|
| o [draft] 12 Y
|/
o [draft] 11 Thing to Fix with Fixup
|
o [draft] 10 Z
|
~


Obviously rolling two commits together shouldn't create any conflicts, since the code of the descendants is untouched. However, I can't find a way to get histedit to allow me to edit that far back in my history, since it needs to edit "A changeset together with all its descendants."



Is this edit possible? How should it be done?










share|improve this question

















  • 1





    Are you using the mercurial Evolve extension?

    – Boris Feld
    Mar 26 at 8:21











  • I'm not. We've got a few repos at work where people have experimented with it, but it's caused as many problems as it's solved.

    – geppettodivacin
    Mar 26 at 12:20











  • BTW if you find something shorter than 4 steps (hg graft + hg histedit + hg rebase twice as outlined in my answer) I'd be curious to know what it is.

    – torek
    Mar 26 at 23:27











  • @geppettodivacin I would be interested to hear about your problems with Evolve as a Evolve core contributor. With evolve, it would be two commands, hg fold -r 11+12 to squash the two commits. Then` hg evolve --all` will automatically rebase X and Y for you.

    – Boris Feld
    Mar 27 at 8:32











  • @BorisFeld This would be great as an answer if you expanded it. I can't use it but future searchers could.

    – geppettodivacin
    Mar 27 at 12:03













2












2








2








I am trying to clean up some local (draft) mercurial history before I push to our master repository. One step that I'd like to take is to squash / roll together a "Fixup" changeset into its parent. My history looks like this:



o [draft] 14 X
|
| o [draft] 13 Y
|/
o [draft] 12 Fixup
|
o [draft] 11 Thing to Fix
|
o [draft] 10 Z
|
~


When done, it should look like this:



o [draft] 13 X
|
| o [draft] 12 Y
|/
o [draft] 11 Thing to Fix with Fixup
|
o [draft] 10 Z
|
~


Obviously rolling two commits together shouldn't create any conflicts, since the code of the descendants is untouched. However, I can't find a way to get histedit to allow me to edit that far back in my history, since it needs to edit "A changeset together with all its descendants."



Is this edit possible? How should it be done?










share|improve this question














I am trying to clean up some local (draft) mercurial history before I push to our master repository. One step that I'd like to take is to squash / roll together a "Fixup" changeset into its parent. My history looks like this:



o [draft] 14 X
|
| o [draft] 13 Y
|/
o [draft] 12 Fixup
|
o [draft] 11 Thing to Fix
|
o [draft] 10 Z
|
~


When done, it should look like this:



o [draft] 13 X
|
| o [draft] 12 Y
|/
o [draft] 11 Thing to Fix with Fixup
|
o [draft] 10 Z
|
~


Obviously rolling two commits together shouldn't create any conflicts, since the code of the descendants is untouched. However, I can't find a way to get histedit to allow me to edit that far back in my history, since it needs to edit "A changeset together with all its descendants."



Is this edit possible? How should it be done?







version-control mercurial






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 19:16









geppettodivacingeppettodivacin

857 bronze badges




857 bronze badges







  • 1





    Are you using the mercurial Evolve extension?

    – Boris Feld
    Mar 26 at 8:21











  • I'm not. We've got a few repos at work where people have experimented with it, but it's caused as many problems as it's solved.

    – geppettodivacin
    Mar 26 at 12:20











  • BTW if you find something shorter than 4 steps (hg graft + hg histedit + hg rebase twice as outlined in my answer) I'd be curious to know what it is.

    – torek
    Mar 26 at 23:27











  • @geppettodivacin I would be interested to hear about your problems with Evolve as a Evolve core contributor. With evolve, it would be two commands, hg fold -r 11+12 to squash the two commits. Then` hg evolve --all` will automatically rebase X and Y for you.

    – Boris Feld
    Mar 27 at 8:32











  • @BorisFeld This would be great as an answer if you expanded it. I can't use it but future searchers could.

    – geppettodivacin
    Mar 27 at 12:03












  • 1





    Are you using the mercurial Evolve extension?

    – Boris Feld
    Mar 26 at 8:21











  • I'm not. We've got a few repos at work where people have experimented with it, but it's caused as many problems as it's solved.

    – geppettodivacin
    Mar 26 at 12:20











  • BTW if you find something shorter than 4 steps (hg graft + hg histedit + hg rebase twice as outlined in my answer) I'd be curious to know what it is.

    – torek
    Mar 26 at 23:27











  • @geppettodivacin I would be interested to hear about your problems with Evolve as a Evolve core contributor. With evolve, it would be two commands, hg fold -r 11+12 to squash the two commits. Then` hg evolve --all` will automatically rebase X and Y for you.

    – Boris Feld
    Mar 27 at 8:32











  • @BorisFeld This would be great as an answer if you expanded it. I can't use it but future searchers could.

    – geppettodivacin
    Mar 27 at 12:03







1




1





Are you using the mercurial Evolve extension?

– Boris Feld
Mar 26 at 8:21





Are you using the mercurial Evolve extension?

– Boris Feld
Mar 26 at 8:21













I'm not. We've got a few repos at work where people have experimented with it, but it's caused as many problems as it's solved.

– geppettodivacin
Mar 26 at 12:20





I'm not. We've got a few repos at work where people have experimented with it, but it's caused as many problems as it's solved.

– geppettodivacin
Mar 26 at 12:20













BTW if you find something shorter than 4 steps (hg graft + hg histedit + hg rebase twice as outlined in my answer) I'd be curious to know what it is.

– torek
Mar 26 at 23:27





BTW if you find something shorter than 4 steps (hg graft + hg histedit + hg rebase twice as outlined in my answer) I'd be curious to know what it is.

– torek
Mar 26 at 23:27













@geppettodivacin I would be interested to hear about your problems with Evolve as a Evolve core contributor. With evolve, it would be two commands, hg fold -r 11+12 to squash the two commits. Then` hg evolve --all` will automatically rebase X and Y for you.

– Boris Feld
Mar 27 at 8:32





@geppettodivacin I would be interested to hear about your problems with Evolve as a Evolve core contributor. With evolve, it would be two commands, hg fold -r 11+12 to squash the two commits. Then` hg evolve --all` will automatically rebase X and Y for you.

– Boris Feld
Mar 27 at 8:32













@BorisFeld This would be great as an answer if you expanded it. I can't use it but future searchers could.

– geppettodivacin
Mar 27 at 12:03





@BorisFeld This would be great as an answer if you expanded it. I can't use it but future searchers could.

– geppettodivacin
Mar 27 at 12:03












1 Answer
1






active

oldest

votes


















2














It's certainly possible. I don't know how to do it easily, though.



The trick is to turn this:



o [draft] 14 X
|
| o [draft] 13 Y
|/
o [draft] 12 Fixup
|
o [draft] 11 Thing to Fix
|
o [draft] 10 Z
|
~


into:



o [draft] 16 Fixup
|
o [draft] 15 Thing to Fix
|
| o [draft] 14 X
| |
| | o [draft] 13 Y
| |/
| o [draft] 12 Fixup
| |
| o [draft] 11 Thing to Fix
|/
o [draft] 10 Z
|
~


where 15 is a copy of 11 and 16 is a copy of 12. (Use hg graft to do this.) You can now use hg histedit to combine these two.



It's now easy to copy 13 and 14 atop the new 15 that has replaced the old 15-and-16:



o [draft] 17 X
|
| o [draft] 16 Y
|/
o [draft] 15 Thing to Fix with Fixup
|
| o [draft] 14 X
| |
| | o [draft] 13 Y
| |/
| o [draft] 12 Fixup
| |
| o [draft] 11 Thing to Fix
|/
o [draft] 10 Z
|
~


Now you can hg strip -r 11 to remove 11, 12, 13, and 14, leaving only the corrected commits. (Note that you can use rebase to simplify this a bit. The long form is mainly for illustration and ease of comprehension.)






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344982%2fhow-to-squash-mercurial-revisions-with-multiple-descendent-heads%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    It's certainly possible. I don't know how to do it easily, though.



    The trick is to turn this:



    o [draft] 14 X
    |
    | o [draft] 13 Y
    |/
    o [draft] 12 Fixup
    |
    o [draft] 11 Thing to Fix
    |
    o [draft] 10 Z
    |
    ~


    into:



    o [draft] 16 Fixup
    |
    o [draft] 15 Thing to Fix
    |
    | o [draft] 14 X
    | |
    | | o [draft] 13 Y
    | |/
    | o [draft] 12 Fixup
    | |
    | o [draft] 11 Thing to Fix
    |/
    o [draft] 10 Z
    |
    ~


    where 15 is a copy of 11 and 16 is a copy of 12. (Use hg graft to do this.) You can now use hg histedit to combine these two.



    It's now easy to copy 13 and 14 atop the new 15 that has replaced the old 15-and-16:



    o [draft] 17 X
    |
    | o [draft] 16 Y
    |/
    o [draft] 15 Thing to Fix with Fixup
    |
    | o [draft] 14 X
    | |
    | | o [draft] 13 Y
    | |/
    | o [draft] 12 Fixup
    | |
    | o [draft] 11 Thing to Fix
    |/
    o [draft] 10 Z
    |
    ~


    Now you can hg strip -r 11 to remove 11, 12, 13, and 14, leaving only the corrected commits. (Note that you can use rebase to simplify this a bit. The long form is mainly for illustration and ease of comprehension.)






    share|improve this answer



























      2














      It's certainly possible. I don't know how to do it easily, though.



      The trick is to turn this:



      o [draft] 14 X
      |
      | o [draft] 13 Y
      |/
      o [draft] 12 Fixup
      |
      o [draft] 11 Thing to Fix
      |
      o [draft] 10 Z
      |
      ~


      into:



      o [draft] 16 Fixup
      |
      o [draft] 15 Thing to Fix
      |
      | o [draft] 14 X
      | |
      | | o [draft] 13 Y
      | |/
      | o [draft] 12 Fixup
      | |
      | o [draft] 11 Thing to Fix
      |/
      o [draft] 10 Z
      |
      ~


      where 15 is a copy of 11 and 16 is a copy of 12. (Use hg graft to do this.) You can now use hg histedit to combine these two.



      It's now easy to copy 13 and 14 atop the new 15 that has replaced the old 15-and-16:



      o [draft] 17 X
      |
      | o [draft] 16 Y
      |/
      o [draft] 15 Thing to Fix with Fixup
      |
      | o [draft] 14 X
      | |
      | | o [draft] 13 Y
      | |/
      | o [draft] 12 Fixup
      | |
      | o [draft] 11 Thing to Fix
      |/
      o [draft] 10 Z
      |
      ~


      Now you can hg strip -r 11 to remove 11, 12, 13, and 14, leaving only the corrected commits. (Note that you can use rebase to simplify this a bit. The long form is mainly for illustration and ease of comprehension.)






      share|improve this answer

























        2












        2








        2







        It's certainly possible. I don't know how to do it easily, though.



        The trick is to turn this:



        o [draft] 14 X
        |
        | o [draft] 13 Y
        |/
        o [draft] 12 Fixup
        |
        o [draft] 11 Thing to Fix
        |
        o [draft] 10 Z
        |
        ~


        into:



        o [draft] 16 Fixup
        |
        o [draft] 15 Thing to Fix
        |
        | o [draft] 14 X
        | |
        | | o [draft] 13 Y
        | |/
        | o [draft] 12 Fixup
        | |
        | o [draft] 11 Thing to Fix
        |/
        o [draft] 10 Z
        |
        ~


        where 15 is a copy of 11 and 16 is a copy of 12. (Use hg graft to do this.) You can now use hg histedit to combine these two.



        It's now easy to copy 13 and 14 atop the new 15 that has replaced the old 15-and-16:



        o [draft] 17 X
        |
        | o [draft] 16 Y
        |/
        o [draft] 15 Thing to Fix with Fixup
        |
        | o [draft] 14 X
        | |
        | | o [draft] 13 Y
        | |/
        | o [draft] 12 Fixup
        | |
        | o [draft] 11 Thing to Fix
        |/
        o [draft] 10 Z
        |
        ~


        Now you can hg strip -r 11 to remove 11, 12, 13, and 14, leaving only the corrected commits. (Note that you can use rebase to simplify this a bit. The long form is mainly for illustration and ease of comprehension.)






        share|improve this answer













        It's certainly possible. I don't know how to do it easily, though.



        The trick is to turn this:



        o [draft] 14 X
        |
        | o [draft] 13 Y
        |/
        o [draft] 12 Fixup
        |
        o [draft] 11 Thing to Fix
        |
        o [draft] 10 Z
        |
        ~


        into:



        o [draft] 16 Fixup
        |
        o [draft] 15 Thing to Fix
        |
        | o [draft] 14 X
        | |
        | | o [draft] 13 Y
        | |/
        | o [draft] 12 Fixup
        | |
        | o [draft] 11 Thing to Fix
        |/
        o [draft] 10 Z
        |
        ~


        where 15 is a copy of 11 and 16 is a copy of 12. (Use hg graft to do this.) You can now use hg histedit to combine these two.



        It's now easy to copy 13 and 14 atop the new 15 that has replaced the old 15-and-16:



        o [draft] 17 X
        |
        | o [draft] 16 Y
        |/
        o [draft] 15 Thing to Fix with Fixup
        |
        | o [draft] 14 X
        | |
        | | o [draft] 13 Y
        | |/
        | o [draft] 12 Fixup
        | |
        | o [draft] 11 Thing to Fix
        |/
        o [draft] 10 Z
        |
        ~


        Now you can hg strip -r 11 to remove 11, 12, 13, and 14, leaving only the corrected commits. (Note that you can use rebase to simplify this a bit. The long form is mainly for illustration and ease of comprehension.)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 23:02









        torektorek

        213k21 gold badges274 silver badges359 bronze badges




        213k21 gold badges274 silver badges359 bronze badges


















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344982%2fhow-to-squash-mercurial-revisions-with-multiple-descendent-heads%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript