Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4104302
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:06:04+00:00 2026-05-20T21:06:04+00:00

I’ve just got a problem with hg push command. What I did – Firstly

  • 0

I’ve just got a problem with hg push command. What I did – Firstly I created 2 branches hot-fix-1 and hot-fix-2 made some changes in each branche, merged it back to default and closed those branches with the command:

hg commit --close-branch  

If I start hg branches I have the following output:

default      29:e62a2c57b17c

hg branches -c gives me:

default                       29:e62a2c57b17c
hot-fix-2                     27:42f7bf715392 (closed)
hot-fix-1                     26:dd98f50934b0 (closed)

Thus hot-fix-* branches seems to be closed. However if I try to push the changes I have the next error message:

pushing to /Users/user1/projects/mercurial/mytag
searching for changes
abort: push creates new remote branches: hot-fix-1, hot-fix-2!
(use 'hg push --new-branch' to create new remote branches)

and it does not matter which command I use hg push -b . or hg push -b default
So the question is how I can push those changes to repository without creating new branches.

P.S I used to work with git and was hoping that similar branching model can be used in Mercurial. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:06:04+00:00Added an answer on May 20, 2026 at 9:06 pm

    First, as many others have pointed out, using a named branch for short lived work is not a recommended practice. Named branches are predominantly for long lived features, or for release management.

    Given that you are in this situation, there are a few options available. All of them involve modifying history (as you’re obviously trying to change something you’ve done).

    One is to just push the branches as is, learn from the experience, and move on. If the rest of the team is fine with this, then it’s a case of adding –new-branch to your push command.

    If the rest of the team, or you, really want the history to be clean, then you’ll need to dig deeper.

    If you aren’t pushing, then definitely make a clone of your current repo. This way you have a copy of the original work to fall back on.

    I see 2 main approaches here. Strip off the merges and rebase your branches onto default. This will get rid of the named branches or graft/transplant your changes. Both will be the same end result, but the implementation is slightly different.

    If you merely want to use graft, that is now a built-in function starting with HG 2.0. It replaces the transplant plugin, and is much nicer to work with as it uses your usual merge tool if there are conflicts.

    To use it, update to the default branch. Then, use the command:

    hg graft -D "2085::2093 and not 2091"
    

    the string after -D is an hg revision selection query. In your case, you’d likely only need ‘{start}::{end}’ where start is the changeset at the start of the branch, and end is the end changeset of the branch (ignoring the merge).

    If you did several merges, you’d have to pick and choose the changesets more precisely.

    The other option is to strip the final merges, and use the rebase command that is part of the mq plugin.

    You’ll have to strip your merge changesets to get rid of them, and then update to the tip of the branch you want to keep. Select the start of the first named branch, and do a rebase. This will change the parentage of the branch (if you’re familiar with Git, then this is very much like it’s rebase).

    Then repeat for the second branch. You should now have one long branch with the name default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.