Use case for private changes

Supposing I have following scenario: I cloned some open-source project, say from URL X. Now I have local clone of it. I made some changes to local clone to try things out and commited them locally. Now what I want is following:

I want to get update from the open-source project X. Just get all its latest code, without my changes at all. But I want my changes to live somewhere in tag in history so I can get them later. And I don't want to separate clone for this, want it all in my one repo.

For now I did following:

<ol> <li>Tag my changes with hg tag</li> <li>Pull & merge latest code from URL X</li> <li>Revert repository to latest revision of URL X </li> </ol>

But I feel this isn't good way and it's roundabout. I think there's better way. Could you please suggest?


Instead of tags, I would use a bookmark. If you use Mercurial 1.8 or later, you already have the bookmark functionality built-in. Otherwise, you first have enable the extension by putting the following in your ~/.hgrc file:

[extensions] bookmarks = [bookmarks] track.current = True

Now get the clone of your project:

hg clone http://bitbucket.org/user/X cd X

and hack away:

# edit, edit, edit... hg commit -m 'Great new feature!'

Now put a bookmark on this changeset

hg bookmark mywork

This is like a tag, but the advantage of a bookmark is that is moves along when you make new commits. This is just like when you're reading a book and move the bookmark along with you. When the bookmark is created, you can do

hg update mywork

to get back to the bookmarked changeset.

When there has been changes made in the upstream repository, then you pull and merge them into your own branch:

hg update mywork # if necessary hg pull hg merge hg commit -m 'Merged new upstream changes.'

The bookmark will have moved forward and is now pointing to the merge changeset you just created. If you want to update to the version in X, then

hg update --rev -2

will do it after you pulled in changes -- this updates to the old tip changeset from before the merge, which was the tip of X.


  • Python Datetime Strptime Error: '-' is a bad directive in format '%-m-%-d-%y %-H:%M:%
  • avconv save 10 frames and update them in cycle
  • Regex to match exactly n occurrences of letters and m occurrences of digits
  • PDFsharp bookmarks in text
  • Notepad++ Custom Function List (Basic)
  • Bookmark page using JavaScript
  • How to Undo Subversion commit
  • How to get the revision of an item with Dropbox API
  • how to get Task id,Feature id,Complete hrs by WIQL tfs by date?
  • How do I determine the revision number of an Android build?
  • How to list all the bucket types in riak?
  • cursor.fetchone() returns None but row in the database exists
  • Shadows for Instantiated Game Object bug?
  • Issue with SVN Commit for certain File Extension
  • Group variable in cobol
  • R h2o.glm - issue with max_active_predictors
  • MySQL multiple IN conditions to subquery with same table
  • How to merge keras sequential models with same input?
  • Is it possible to get the word under the mouse cursor in a ``?
  • hibernate sets dirty flag (and issues update) even though client did not change value
  • BeautifulSoup difference between findAll and findChildren
  • NHibernate manually control fetching
  • How can Delete be both a DDL and a DML statement
  • Redshift Querying: error xx000 disk full redshift
  • Simulate click Geckofx vb,net
  • How can I speed up CURL tasks?
  • Moving Android View and preventing onDraw to be called over and over again
  • Rails Find when some params will be blank
  • Deselecting radio buttons while keeping the View Model in synch
  • Different response to non-authenticated users and AJAX calls
  • C# - Serializing and deserializing static member
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Incrementing object id automatically JS constructor (static method and variable)
  • Do create extension work in single-user mode in postgres?
  • How can I estimate amount of memory left with calling System.gc()?
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Circular dependency while pushing http interceptor
  • Linker errors when using intrinsic function via function pointer
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Is there any way to bind data to data.frame by some index?