Quantcast
Channel: 软件应用 –笑遍世界
Viewing all articles
Browse latest Browse all 51

git和hg (mercurial)的一些基本用法

$
0
0

还是快毕业时到公司实习那时开始接触版本管理工具,当时及前两年都是一直用svn来做SCM工具,而最近这一年做Open Source,主要用git和mercurial (hg)来做SCM工具了。其实,现在看来,其实作为非专业SCM人员,作为一个Developer或者QA,多数情况下只需要简单了解其中原理和基本命令即可。本文主要根据git和mercurial官网的Quick Start简单修改一下,这些东西应对我目前偶尔涉及到的基本SCM相关的工作已经足够了。

本文是介绍git和mercurial (hg)的使用,如果想了解svn,可以看我曾经的一篇博客:
svn资料: http://renyongjie668.blog.163.com/blog/static/16005312010612101745810/

Git Quick Start

Cloning and Creating a Patch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ git clone git://github.com/git/hello-world.git
 
$ cd hello-world
 
$ (edit files)
 
$ git add (files)
 
$ git commit -m 'Explain what I changed'  #(local)
 
$ git format-patch origin/master
 
$ git push           #(remote)
 
$ git status


Creating and Commiting

1
2
3
4
5
6
7
8
9
10
11
$ cd (project-directory)
 
$ git init
 
$ (add some files)
 
$ git add .
 
$ git commit -m 'Initial commit'
 
$ git status

 

Mercurial (hg) Quick Start

Clone a project and push changes

1
2
3
4
5
6
7
8
9
10
11
12
13
$ hg clone http://selenic.com/repo/hello
 
$ cd hello
 
$ (edit files)
 
$ hg add (new files)
 
$ hg commit -m ‘Explain what I changed’
 
$ hg push
 
$ hg status

Create a project and commit

1
2
3
4
5
6
7
8
9
10
11
$ hg init (project-directory)
 
$ cd (project-directory)
 
$ (add some files)
 
$ hg add
 
$ hg commit -m 'Initial commit'
 
$ hg status

 

reference links:

http://git-scm.com/

http://mercurial.selenic.com/

Original article: git和hg (mercurial)的一些基本用法

©2015 笑遍世界. All Rights Reserved.


Viewing all articles
Browse latest Browse all 51

Trending Articles