Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a hg bookmark after committing a changeset

I cloned a Mercurial repo and made some changes in the checked out code. I then grabbed those changes (7 files) and committed them with hg commit but without having created a bookmark first.

This is the output of my hg summary command:

parent: 8172:b39efc1322fe tip
  Made some changes in my feature
branch: default
commit: 7 modified
update: 2 new changesets, 3 branch heads (merge)
phases: 3 draft

These changes won't be ready to be pushed for at least another week, so I want to switch to a new bookmark and work on other parts of the code.

The problem is that I realized that I had made a commit without being in a bookmark, so I'm afraid that after switching to a new bookmark my committed changes could be lost.

Is there an easy way to move these committed changes into a new bookmark?

like image 477
Mike Laren Avatar asked Jun 29 '15 17:06

Mike Laren


1 Answers

There is no need to be afraid at all: mercurial won't forget anything you committed unless you explicitly do both: enable history editing extensions and willingly use them in a way that you actually remove one or more changesets.

Mercurial is not git and mercurial does never forget or garbage-collect a changeset when it is not currently checked out and has no name (bookmark) attached to it.

You can show you all your heads using hg heads. And you can always create new bookmarks, attached to an arbitrary changeset by hg bookmark --rev XXX MyBookmark where XXX is the changesetID to which you want to attach the bookmark.

like image 195
planetmaker Avatar answered Oct 16 '22 17:10

planetmaker