31

I can delete remote branches in Git using git push. (See How do I delete a remote branch in Git?). But I can't do the equivalent using Mercurial bookmarks.

I've tried hg bookmark -d something, but when I push to a Git repository using hg-git, it does not delete the bookmark on the remote repository.

When I try hg bookmark -d origin/something, it complains that it doesn't exist.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Lambda Fairy
  • 13,814
  • 7
  • 42
  • 68

2 Answers2

49

To delete a bookmark from a remote server, you must have permission to push to the server. If you can push to it, then you can:

hg bookmark --delete <bookmark name>
hg push --bookmark <bookmark name>

See the "Working With Remote Repositories" section of the Mercurial BookmarksExtension wiki for further info.

NOTE: This only removes the bookmark itself. It does not remove any changesets that were associated with the bookmark. If you need to remove the changesets themselves, then you must consider other methods as noted in these related questions.

Community
  • 1
  • 1
Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
  • That doesn't seem to work with hg-git: it complains that the bookmark doesn't exist on the remote server. That's probably a bug in hg-git, though. – Lambda Fairy Sep 06 '11 at 06:06
10

With hg-git it is not possible at the moment.

You have to install the git client, clone the repo and issue a

git push origin :oldbranch

to delete the old branch. Hopefully there will be a patch one day.

hyperknot
  • 13,454
  • 24
  • 98
  • 153