Skip to content

Instantly share code, notes, and snippets.

@vonkoch
Last active December 18, 2015 21:39
Show Gist options
  • Select an option

  • Save vonkoch/5848773 to your computer and use it in GitHub Desktop.

Select an option

Save vonkoch/5848773 to your computer and use it in GitHub Desktop.
hg
Show me what was pulled but not yet updated
hg log -r .:
or
hg log -P .
Compare
hg log -r .: -P .
Put the following in your $HOME/.hgrc file:
[alias]
new = log -P .
Undo a "pull"
hg rollback
34. Merge or rebase with uncommitted changes
It is not possible to merge or rebase when there are uncommited local changes in the working copy. Some recommend using the shelve extension or mq to handle that, but there is an even easier way. First put your local changes in a patch file, then revert the changes in the working copy.
hg diff > somefile # save local changes
hg revert -a # nuke 'em
Now you can do your merge or rebase in your clean working copy.
When you're done you reapply the changes again:
hg import --no-commit somefile
Originally described by Matt on the users list.
Pasted from <http://mercurial.selenic.com/wiki/TipsAndTricks>
hg color extension in Powershell
If you turn on the color extension in mercurial by having the following in mercurial.ini or .hgrc
[color]
it will by default use the ANSI color mode which works in the regular Command Prompt but not in PowerShell. To make it work in PowerShell you have to enable Win32 color mode.
[color]
mode = win32
http://stackoverflow.com/questions/3984001/mercurial-color-extension-in-windows-powershell
hg dropbox
First, clone your repo into your Dropbox:
~$ cd ~/Dropbox
~/Dropbox$ hg clone ~/myproj ~/Dropbox/myproj-hg --noupdate
The syntax is hg clone <from> <to>. The --noupdate flag tell Mercurial to just store the repository data, not to check out a working copy. You're never going to work directly in the Dropbox directory, but instead use it as a "remote" where you push and pull to and from it. The only thing that will ever be in that directory is the.hg directory, and there's no user-serviceable parts in that particular one. That's why I renamed myproj tomyproj-hg in the clone step, just so I remember that it's a Mercurial directory, and it's supposed to be "empty" (because the .hg will be hidden on Linux).
Pasted from <http://www.h4ck3r.net/2010/05/11/mercurial-hg-with-dropbox/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment