hg-git tutorial? [was Re: Bookmarks with hg update question]
Bryan Murdock
bmurdock at gmail.com
Tue Jul 5 21:07:28 UTC 2016
On Tue, Jul 5, 2016 at 2:44 PM, Bryan Murdock <bmurdock at gmail.com> wrote:
> On Wed, Jun 29, 2016 at 2:36 PM, Harvey Chapman <hchapman-hg at 3gfp.com> wrote:
>>> On Jun 29, 2016, at 4:14 PM, Bryan Murdock <bmurdock at gmail.com> wrote:
>>>
>>> On Tue, Jun 28, 2016 at 4:11 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
>>>> That should get me going, thanks!
>>>
>>> Once you have the extension enabled you can type hg help git and
>>> there's some helpful stuff there.
>>
>> based on that help, I find the following alias helpful. It shows the current hg and git hashes.
>>
>> # .hgrc
>> [alias]
>> hashes = !$HG log -l 1 --template 'hg/git hashes: {node|short} {gitnode|short}' -r $($HG id -r . -i)
>>
>> # Usage
>> $ hg hashes
>> hg/git hashes: 623501e31414 592cc49c0031
>
> Thanks! It doesn't come up often, but when you need to know the git
> hash for an hg-git commit you are looking at, that's nice to have.
Here are some aliases I just put together to convert revisions both ways:
# for hg-git:
hg2git = log -r $1 --template '{gitnode|short}'
git2hg = log -r 'gitnode($1)' --template='{rev}:{node|short}\n'
Use them like:
hg hg2git <mercurial revision>
hg git2hg <git hash>
Bryan
More information about the Mercurial
mailing list