I created new branch BRANCH1 from default. Made some changes. And i can not hg push --new-branch. How to push it ? Without using hg push -f ?
That is the error
$ hg push --new-branch
pushing to ssh://hg#bitbucket.org/BLABLA
searching for changes
abort: push creates new remote head 124786qssdvfsd12 on branch 'BRANCH2'!
(merge or see "hg help push" for details about pushing new heads)
Not sure what is the issue exactly, but I suggest that you try to push the head from the earlier message:
hg push -r 124786qssdvfsd12
If this command runs successfully, then you should try again:
hg push --new-branch
Related
I cloned an hg repo and created a feature branch (via hg branch myfeature). I have staged & committed changes to it via hg add . and then subsequently hg commit -m "My new feature branch.".
I would now like to push those changes (in the branch; not as default) to the remote server (where I cloned the project from) so that other devs can code review the changes in the myfeature branch.
I found a blog that recommends using:
hg push --create-branch-remote
But this isn't working for me - any ideas where I'm going awry?
You forgot to read hg help push for your version of Mercurial
...
--new-branch allow pushing a new branch
...
Looks like --new-branch is what I wanted.
So someone deleted a remote branch, but a changeset was lost when he deleted the branch.
I have the changeset on my local repository and tried to merge the changeset to my default branch, then I pushed, but I got an error "abort: push creates new remote head 650367cd0ff4 on branch 'rc'!"
There are few options, depending on the situation you have:
If the whole branch was stripped and you have that branch locally then you can push it again:
hg push --new-branch
This is recommended, because Mercurial will anyway send your local commits to remote repo every time you will do push (until you strip these commits locally). You can then close unwanted branch with --close-branch (this will leave all commits in repo, but just mark branch as closed/unused).
hg ci --close-branch
Graft the wanted commit locally from some branch to other:
hg graft -r 123
hg push
Create new remote head ("abort: push creates new remote head 650367cd0ff4 on branch 'rc'!"). It's nothing wrong, it just means that one of your branches will have two separate top commits. These commits can be merged together later.
hg push -f
Is it possible to move a bookmark from one head to another without committing any file changes? I've tried:
hg update <destination-head>
hg bookmark bookmark-to-move -f
hg commit
But Mercurial complains nothing changed and when I try to hg push -f I get no changes found. Any ideas?
You need to use the -B flag to hg push in order to make it move the bookmark.
If a bookmark is already exported (present in both source and destination), then a simple hg push will move the bookmark forward in the destination. In your case, the local bookmark is not a descendant of the remote bookmark, and so hg push alone will no move it.
Using
hg push -B bookmark-to-move
will work and move the remote bookmark as you want.
you can also run
hg bookmark -r . yourbookmark
hg update yourbookmark
I can't figure out why i'm still unable to push to a remote repository:
> hg pull
pulling from ......
searching for changes
no changes found
> hg merge
abort: branch 'default' has one head - please merge with an explicit rev
(run 'hg heads' to see all heads)
> hg heads
changeset: 12942:...
tag: tip
parent: 12940:...
parent: 12941:...
summary: merge
> hg branches
default 12942:...
> hg commit
nothing changed
and finally
> hg push
pushing to ...
searching for changes
abort: push creates new remote heads on branch 'default'!
(did you forget to merge? use push -f to force)
why would that be?
Not sure why, but this solved the issue:
hg push -r tip
where -r is
-r --rev REV [+] a changeset intended to be included in the destination
I'm trying to get the hg-git extension working under Windows and after hours of fiddling, I finally seem to have it working. However, nothing shows up in my git repository even though the output of hg push reads:
importing Hg objects into Git
creating and sending data
github::refs/heads/master => GIT:8d946209
[command completed successfully Wed Oct 20 15:26:47 2010]
Try issuing the command hg bookmark -f master
(use -f to force an existing bookmark to move)
Then try pushing again.
This works because Hg-Git pushes your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks. (from the official README.md)
And it seems that just after I asked this, I made a trivial change. This was picked up and pushed. So it seems that you have to wait until you've made a new commit in order for hg-git to pick it up.
I had chosen to 'Initialize this repository with a README'. This meant I ended up with two heads, which I couldn't hg merge because one had a bookmark.
To get pushing working, I had to:
configure hg-git and github remote as per https://blog.glyphobet.net/essay/2029
pull from github and update
force the merge (checking which id to use with hg heads),
commit the merge
add a trivial change to a file (add a space char to the end),
commit, then
move the bookmark to the tip
push to my configured github remote
This ended up with commands as follows (substituting in <x> sections)
hg pull github
hg update
hg merge <revision-id-of-incoming-git-version>
hg addremove
hg commit -m 'merged with github'
# make some trivial change to a file - eg add a space where it doesn't cause harm
hg add <changed-file>
hg commit -m 'trivial change'
hg bookmark -f master
hg push github
make sure you pick the remote revision for the merge above - if you don't it doesn't work!