Table of Contents
How can I import a Mercurial repository to GitHub?
How can I diff two revisions in Mercurial?
How can I commit a subset of the modified files of a Mercurial repository?
How can I set my username for all Mercurial projects?
How can I set the editor for all Mercurial projects?
How can I get the list of branches?
How can I create a new branch?
How can I update to the tip revision?
How can I switch to an existing branch?
How can I update to a specific revision?
How can I update to the latest revision at a specific date?
How can I find the revision of the working folder?
How can I tell whether a file is ignored or not committed at all?
How can I colorize hg?
How can I push changes to a different remote repository?
How can I pull changes from a remote repository?
How can I pull changes from a remote repository?
How can I browse the history of a Mercurial repository graphically?
How can I discard uncommitted changes?
How can I apply a commit to another branch?
How can I discard my last commit?
How can I discard a given commit?
How can I set up Mercurial to use meld as its merge tool?
How can I create a patch of my uncommitted changes?
How can I install the latest release of Mercurial?
How can I import a Mercurial repository to GitHub?
21 Apr 2014
-
mercurial,
git
Run the following commands to install git remote hg.
wget https://raw.github.com/felipec/git/fc/master/git-remote-hg.py -O ~/apps/git-remote-hg
chmod +x ~/apps/git-remote-hg
export PATH=$PATH:~/apps
Clone the mercurial repository as a bare git repository.
git clone --bare "hg::https://code.google.com/p/jsr308-langtools/" bare-jsr308-langtools
Create an empty GitHub repository
git push --mirror https://github.com/reprogrammer/jsr308-langtools.git
Mirror the bare git repository on github.
cd bare-jsr308-langtools
git push --mirror https://github.com/reprogrammer/jsr308-langtools.git
References
- https://github.com/felipec/git/wiki/git-remote-hg
- https://help.github.com/articles/importing-an-external-git-repository
How can I diff two revisions in Mercurial?
05 Dec 2013
-
mercurial
hg diff -r <rev1> -r <rev2>
References
How can I commit a subset of the modified files of a Mercurial repository?
19 Oct 2013
-
mercurial
Run the following command to commit only file1
and file2
.
hg commit file1 file2
References
How can I set my username for all Mercurial projects?
05 Oct 2013
-
mercurial
Add the following piece of code to your .hgrc
file.
[ui]
username = FirstName LastName <username@domain.com>
How can I set the editor for all Mercurial projects?
04 Oct 2013
-
mercurial
Add the following piece of code to your .hgrc
file.
[ui]
editor = vim
How can I get the list of branches?
03 Oct 2013
-
mercurial
hg branches
How can I create a new branch?
02 Oct 2013
-
mercurial
hg branch <branch-name>
References
How can I update to the tip revision?
01 Oct 2013
-
mercurial
hg update
How can I switch to an existing branch?
30 Sep 2013
-
mercurial
hg update <branch-name>
How can I update to a specific revision?
29 Sep 2013
-
mercurial
hg update REV
References
How can I update to the latest revision at a specific date?
28 Sep 2013
-
mercurial
hg update -d yyyy-mm-dd
References
How can I find the revision of the working folder?
27 Sep 2013
-
mercurial
hg parent
References
How can I tell whether a file is ignored or not committed at all?
26 Sep 2013
-
mercurial
hg status --all
References
How can I colorize hg?
25 Sep 2013
-
mercurial
Add the following piece of code to your .hgrc
file.
[extensions]
color =
[color]
mode = auto
References
How can I push changes to a different remote repository?
24 Sep 2013
-
mercurial
First, add the path to the remote repository to .hg/hgrc
.
[paths]
remote-name = http://path/to/remote-name
Then, push the changes in your local repository to the remote repository:
hg push remote-name
If your changes belong to new branches, use the following command:
hg push --new-branch remote-name
References
How can I pull changes from a remote repository?
23 Sep 2013
-
mercurial
hg pull remote-name
If you use the -u
option, the pulled changes will be applied on your branch:
hg pull -u remote-name
How can I pull changes from a remote repository?
22 Sep 2013
-
mercurial
hg addremove
References
How can I browse the history of a Mercurial repository graphically?
21 Sep 2013
-
mercurial
Enable the hgk
extension by adding the following to your .hgrc
file.
[extensions]
hgk =
Then, invoke the following command inside the directory of your mercurial repository:
hg view
References
How can I discard uncommitted changes?
20 Sep 2013
-
mercurial
hg up -C
How can I apply a commit to another branch?
19 Sep 2013
-
mercurial
Run the following command to apply change set <change-set>
to the current
branch.
hg graft <changeset>
References
How can I discard my last commit?
18 Sep 2013
-
mercurial
hg rollback
How can I discard a given commit?
17 Sep 2013
-
mercurial
hg strip <changeset>
References
How can I set up Mercurial to use meld as its merge tool?
16 Sep 2013
-
mercurial
Add the following to ~/.hgrc
:
[ui]
merge = meld
[merge-tools]
meld.priority = 1
meld.premerge = False
meld.args = $local $other $base
[merge-patterns]
** = meld
When meld opens the local (the working copy version), other (the remove version,
which is being merged into local), and base (common parent of local and other)
versions of the file, edit the middle pane (other), for this is the file in your
repository. The other two are kept in /tmp
.
References
How can I create a patch of my uncommitted changes?
15 Sep 2013
-
mercurial
hg diff -g > uncommited.patch
References
How can I install the latest release of Mercurial?
17 Feb 2013
-
linux,
mercurial
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 323293EE
sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get upgrade
References