Archives

Archive for the ‘Git’ Category

I work in branch master and there are some changes uncommited. Now I have some ideas and want to try it *without* effecting the branch master. I first create a branch test and then checkout to branch test.

kill-bill:/home/root/sdc/qemu/qemu-omap/svn# git branch test

kill-bill:/home/root/sdc/qemu/qemu-omap/svn# git checkout test

Switched to branch "test"

kill-bill:/home/root/sdc/qemu/qemu-omap/svn# git branch

master

*test

And then I work in branch [...]

Dec 12th, 2008 | Filed under Git

上一篇文章中,介绍了如何在google code中使用Git svn。现在又有了新问题。比如项目qemu-omap3是想往开源项目qemu中增加一个新的功能。qemu-omap3的项目hosting是在google code上面,使用Git svn来管理。而qemu在http://repo.or.cz/w/qemu.git,使用Git来管理。
为了开发qemu-omap3,需要从某一天的qemu中拿下来所有的源码,然后在这个基础上进行开发。但问题在于qemu的开发也同时在进行。这就需要qemu-omap3中的代码能保持和qemu中的同步。也就是说,我的需求如下:
1.  使用git svn来管理qemu-omap3
2. 能得到最新的qemu的代码
3. 最新的qemu的代码不影响我的qemu-omap3

之前解决的方法是定期从qemu中拿下所有的源码,然后在qemu-omap3中建立一个branch,然后拷贝过去,进行merage。这个过程比较繁琐。
实际上,可以通过git remote命令来增加一个新的remote repo。
git remote add qemu http://repo.or.cz/r/qemu.git
git fetch qemu

这会在git中自动建立一个branch qemu并且会将所有的qemu中的branch等全部放到qemu下。下面是目前我的branch。
kill-bill:/home/root/sdc/qemu/qemu-omap/svn# git-branch -a * master   qemu/master   qemu/svn/perso   qemu/svn/tags/initial [...]

Oct 24th, 2008 | Filed under Git

相比sf,googlecode的使用更加简单和方便。虽然在功能方面没有sf多,但是对于一个开源项目来说,基本上够用了。google code的功能有wiki,下载,svn,issue report。最近googlecode的svn中又增加了一个code review的功能,也就是说别人可以浏览SVN中代码并且留下comment。详细见google的介绍:http://code.google.com/p/support/wiki/CodeReviews
虽然google提供的SVN功能不错,但是我喜欢在本地用GIT来管理我的代码。之前我的使用方法是用svn co下来一份代码,然后git建一个本地仓库,所有的代码修改log都进入本地仓库。当完成一个功能后,用svn commit进googlecode。这样做的缺点在于本地git的log不能反应到svn中。也就是说svn中的log信息都是比较粗线条的,不能很细化的反应项目的变化情况。
于是就需要请出我们今天的主角:git-svn。首先在ubuntu中安装它。
sudo apt-get install git-svn

    安装完以后,需要checkout出google code svn中的东西来。
git-svn clone https://omap3emu.googlecode.com/svn -T trunk -b branches -t tags

这会在本地生成一个文件夹svn。里面就是google code svn中的东西。请记住,GIT的远端仓库和本地目录都是在一起的。我们来看一下目前的GIT仓库中有哪些branch。

Oct 15th, 2008 | Filed under Git