Posts Tagged ‘scm’

git

星期六, 10月 4th, 2008

git是一种分布式的版本控制软件。前段时间完成GSoC的时候用过一段时间,非常强悍!下面是一些资源以及一些常用的命令。

 

Resources

  • 中文教程

http://www.bitsun.com/documents/gittutorcn.htm

  • gitHub上的guide (强列推荐)基本上你想问的问题都有了

http://github.com/guides/Home

  • 上面的精简版

http://www.sourcemage.org/Git_Guide

  • Kernel Hackers’ Guide to git

http://linux.yyz.us/git-howto.html 最后,最重要的还有官方文档。

 

Useful Commands

Day of GIT

    $ git clone http://xxx
    $ git branch gsoc           # new branch
    $ git log #浏览历史
    $ git show 12798172e98f1    #显示相应的版本
    $ git-tag old 12798172e98f1 #为版本命名
    $ git diff a..old a..gsoc   #比较两个版本

 

Revert

回到上次的commit状态(撤除现有的所有修改) $ git reset –hard 回到某个commit状态 $ git revert $id

 

Merge

合并两个branch $ git merge $id

 

remote

push一个branch [code]$ git push origin branch-name[/code]

删除一个branch [code]$ git push origin :branch-name[/code]

Misc

这样一个场景

        repos in web
        /               \
repos1          repos2
 |
 branch-my

现在要把原来在branch-my移到repos2下,可以通过patch来完成。

To Be Continued…