2010年5月7日星期五

SVN,HG,GIT命令对照

SVN,HG,GIT 是三种常见的版本控制系统,本文简单列出一些相似的操作命令。当然,三种系统各有特点,严格的对应关系是没有的。

1,第一次下载,包括源 码和版本库:
svn checkout http://path/to/repo repo_name
hg clone http://path/to/repo  repo_name
git glone http://path/to/repo repo_name或者git glone git://path/to/repo repo_name

2,下载服务器上最新的更新:
svn update
hg pull && hg update -C
git pull

3,检出某个修订版本
svn checkout -r <rev>
hg update -C -r <rev>
git reset --hard -r <rev>

4,新增被跟踪文件
svn add /path/to/file
hg add /path/to/file
git add /path/to/file

4,移除被跟踪文件
svn rm /path/to/file
hg remove /path/to/file
git rm /path/to/file

5, 生成补丁
svn diff  >patch_file
hg diff >patch_file
git diff >patch_file

6,提交更改
svn commit
hg commit
git commit

6, 查看当前状态
svn info
hg status
git status

7,查看修订记录
svn log
hg log
git log

8,启动服务器
svnserve -d
hg serve -p 8002 &
git daemon --base-path=/path/to/repo --export-all &

如有错误请指正,谢谢。

====
git commit只是提交到你本机

还要 git push 才可以推到server中去

没有评论:

发表评论