有些事情想不通怎么办,有了hg,git怎么会流行起来的

the Hg-Git mercurial plugin
This is the Hg-Git plugin for Mercurial, adding the ability
to push to and pull from a Git server
repository from Mercurial. This means you can collaborate on Git
based projects from Mercurial, or use a Git server as a
collaboration point for a team with developers using both Git
and Mercurial.
The Big Idea
The Hg-Git plugin can convert commits/changesets
losslessly from one system to another, so you can
push via a Mercurial repository and another Mercurial
client can pull it. In theory, the changeset IDs should
not change, although this may not hold true for complex
histories.
Clone a Git repository
hg clone git:///schacon/some-repo.git
Like with normal hg clone, you can optionally
specify a destination directory.
Push an existing Hg repository to Git
$ cd mercurial-repo
$ hg bookmark -r default master # so a ref gets created
To avoid specifying the repo path when you push and pull,
edit .hg/hgrc and add:
default = git+ssh:///schacon/some-repo.git
for more detail on path settings.
This will convert all Mercurial data into Git objects
and push them up to the Git server.
That will pull down any commits that have been pushed to the
server in the meantime and give you a new head that you can
Installing
Installing Hg-Git the easy way:
First, make sure that you have a working C compiler on your
system. On Windows, one option is the
free . (Be sure to install the 2008 version for
compatibility reasons.) On Debian-style Linux,
run apt-get install python-dev.
Secondly, run easy_install hg-git. If you don't
have easy_install available, you can get it as part of
Alternatively, on Windows,
comes with hg-git (and Dulwich), though it
as shown below (or through the TortoiseHg settings).
Lastly, make sure the
following is in your ~/.hgrc:
[extensions]
hgext.bookmarks =
...and that's it!
Installing Hg-Git manually
Use this method if you'd like to install a clone of the Hg-Git
repository rather than a static package, or if you'd like to
install Hg-Git in a location you choose yourself.
First, install version 0.8.0 or newer of
You can do
easy_install 'dulwich>=0.8.0' if you have
installed. Next, clone
somewhere. Lastly, make the 'extensions' section in your
'~/.hgrc' file look something like this:
[extensions]
hgext.bookmarks =
hggit = [path-to]/hg-git/hggit
That will enable the Hg-Git extension for you. The bookmarks
section is only required prior to hg 1.7. Bookmarks will be
translated to git heads when pushing.
Dependencies
Different versions of hg-git are known to work with different
versions of Mercurial. For the most accurate info, go to
, click the dropdown menu that says "default",
click the "Tags" tab, select the version you've installed, and
click on the file "Makefile". There's a line that starts with
"all-version-tests" which lists the versions of Mercurial
known to work.
It also needs Dulwich version 0.8.0 Dulwich
is a pure-Python implementation of the Git file formats and
protocols. There are no Git binary
dependencies: you do not need to have Git installed
on your system.
Source available via
(canonical repo) or
of hg). Patches preferred via email to
This plugin was originally developed by the folks
at , and is currently
maintained by Augie Fackler.
This website is .
Please help us by forking the project and adding to it.SVN,HG,GIT命令对照
下载地址:
查看相关资料  &
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款
本周热门内容
copyright & &广电电器(中国梧州) -all right reserved& 若您有什么意见或建议请mail: & &
地址: 电话:(86)774-2826670& & &&)fsjoy1983 的BLOG
用户名:fsjoy1983
文章数:301
评论数:298
访问量:1130220
注册日期:
阅读量:5863
阅读量:12276
阅读量:374403
阅读量:1067994
51CTO推荐博文
第一课. git简介
内容:什么是git,为什么要使用git以及获取和学习git的途径。
欢迎来到github学习教程的第一课。本教程将通过一系列的实例来介绍如快速,轻松地使用Git。教程中会有很多屏幕截图,希望这样可以让你更好的学习和理解。
本节简要介绍git的概念和为什么应该使用它
git是一个快速,开源,分布式的版本控制系统。因此,它在(开源)和(协作编程社区)很快取代了svn。
版本控制系统&
首先,git是一个版本控制系统,用来保留工程源代码历史状态的命令行工具。类似于SVN,CVS或者Perforce等工具。
当你需要得到以前的一个保存点时,你可以利用它来追踪项目中的文件,并且得到某些时间点提交的项目状态。你可以和合作伙伴共享这些历史状态,将他们的工作和你的工作进行合并,可以对整个工程或某些文件跟历史版本进行比较或者恢复到早期的某个版本。
因为git根本上说是一个命令行工具,所以本教程中的大部分示例都会用命令行的方式给出。教程中使用现行git版本(1.6系列)编写示例。如果使用早期版本的话,我们也建议您升级到1.6系列。当然,现在已经有很多git UI的工具,使得git变得更加简单易用。
git的安装:
下载地址
http://www.kernel.org/pub/software/scm/git/&
安装过程:

1.$ tar xzvf git-1.6.5

2.$&cd git-1.6.5

3.$&./config --prefix=/usr/local


5.$&sudo make install

6.$&git --version
如果需要命令帮助的话,可以键入'-help'就会显示出
操作手册。你也可以键入'git help command'实现同样的目的。
$ git log --help
$ git help log
git是一个开源项目,有很多年的历史了,它的大部分内容都是用C来写的。
650) this.width=650;" onclick='window.open("/viewpic.php?refimg=" + this.src)' alt="" src="../attachment/153621.png" border="0" />
你可以得到整个项目的源代码,加以分析和改进。下载源程序的地址:/download。git许可证:GNU通用公共许可证(GNU General Public License)
离线,速度快&& git是完全的分布式处理,这意味着它可以离线工作。跟VCS工具例如Perforce或者SVN完全不同,Git的所有操作几乎不需要网络连接,包括历史回顾,差异显示和提交。
这也意味着Git比其他的VCS工具要快很多,因为某些VCS工具对网络的依赖会导致时间上的延迟。下面来看看'log'命令分别运行在git和SVN上的结果:
[master]$ time git log & /dev/null
real 0m0.352s
user 0m0.300s
sys 0m0.034s&
$ time svn log & /dev/null
real 0m3.709s
user 0m0.482s
sys 0m0.168s
git仅用了0.3秒而SVN用了3.7秒。你会发现几乎所有的命令都有这样的时间差异。例如,添加知名的famfamfam出品的图标集并提交,因为使用git可以将【提交(commit)】和【上传('push')网络】这两个步骤分开,其中【提交(commit)】git只用1/4秒,而SVN会用到45秒。
time ' git commit -m "added icons"'
real 0m0.273s
user 0m0.032s
sys 0m0.008s
time ' svn commit -m "added icons"'
real 0m45.276s
user 0m15.997s
sys 0m5.503s
即使是再加上用git 提交(commit)之后再上传(push)到网络共享仓库中的时间,也比SVN的耗时要少的多的多。
time git push
real 0m6.219s
user 0m0.023s
sys 0m0.011s
如果你仅仅是想提交然后继续工作,你就会感觉到时间上的巨大差异--因为git的工作流程跟以前的版本控制系统不大一样。git的命令大部分都是即时的,不像以前,执行'svn commit'命令之后,可以喝杯咖啡再回来继续工作。
git比较节省空间。举例来说,一个Django项目如果使用现行的源代码控制系统(source control systems)来实现版本控制的话,git克隆(clone)是最小的。
$ du -d 1 -h
108M ./django-bzr
&44M ./django-git
&53M ./django-hg
&53M ./django-svn
更神奇的是,虽然git克隆比SVN要小很多,但是git克隆包含整个项目的历史版本---从第一次提交之后的每一个文件的每一次提交的版本都囊括了。然而,SVN只包含项目的最后一个版本。
快照,而不是变更集
跟其他的VCS工具不同,git是基于快照的。不再是考虑将提交点存储成补丁文件,而是在你提交项目的时候对项目做一个简单的快照。
提交的东西包含一些元数据(提交信息(message),作者,日期等等),一个提交点指向这次提交时项目的快照。
650) this.width=650;" onclick='window.open("/viewpic.php?refimg=" + this.src)' alt="" src="../attachment/570699.png" border="0" />
记住这个图对于给定情形下使用Git是非常有帮助的。
如果要了解更深层次的Git存储数据的只是,可以访问
分支和合并也许git最显著的一个特点就是它的分枝模型了,因为它改变了开发者工作的基本模式。以前的VCS工具分枝的方法是对每一个分枝都放到一个独立的目录中。而git可以让你在同一个工作目录中切换(switch)到不同的分枝。创建和切换分枝几乎是即时的(instant),而且并不是所有的分枝都需要上传到git仓库中去共享,对于某些你更愿意隐藏在本地的工作来说,git无疑提供了很大的便利。从这点上来说,git确是有其独到之处。
摒弃了CVS只对项目开发主线创建分枝的做法,git开发者可以随时创建,合并,删除多个分枝。通常对于实现某个功能或者每个debug阶段,都可以创建它的分枝,当完成之后再将其进行合并。这种模式可以让开发者体验更加快速,简便,安全的方式来开发项目。它鼓励一种非线性的开发周期,它可以说是并行的多线程模式而不是多个步骤串行的模式。
安装git参见中对于git安装在不同操作系统中的说明。
资源关于git的更多信息,可以参考
了这篇文章
类别:┆阅读(0)┆评论(0)

我要回帖

更多关于 想不通的事情怎么办 的文章

 

随机推荐