git概览

0 views
Skip to first unread message

songwei

unread,
Dec 15, 2009, 11:38:20 PM12/15/09
to groo...@googlegroups.com

Git是个分布式版本控制系统,用C语言编写的。这种分布式系统无须集中的代码库,每个人都保有源代码的完整copy(包括历史),可以在本地执行版本控制操作,然后日后合并置远程库。

 

 

(注意:以下提供的地址如连接不上,请翻墙。由于发行包都是基于unix平台的,Windows需要先装Cygwin

下文是Lars Vogel 提供的Git教程:http://www.vogella.de/articles/Git/article.html

 

下面是git的下载地址:http://git-scm.com/download

包含有常用命令列表的地址:http://git-scm.com/documentation

常用命令摘录

Local Commands(本机使用)

 

git config

Get and set repository or global options

查看及设置库或全局选项

git init

Create an empty git repository or reinitialize an existing one

创建空git库或重新初始化已有git

git add

Add file contents to the index

将文件加入库

git status

Show the working tree status

查看哪些需要提交、哪些还没加入库

git commit

Record changes to the repository

提交

git log

Show commit history

查看提交历史

git show

Show information on any object

显示各种信息(比如作者、提交者、提交时提供的信息等)

git tag

Create, list, delete or verify tags

创建、罗列、删除或校验标记

 

Remotey Commands(与远程库同步使用)

 

git clone

Clone a repository into a new directory

克隆一个新库

git remote

Manage set of tracked repositories

管理远程库(本身还有很多选项)

git pull

Fetch from and merge with another repository or a local branch

从另一库或本地分支中Fetchmerge

git fetch

Download objects and refs from another repository

下载远程库内容并保存在本地指定命名空间(本地引用),便于离线使用

git push

Update remote refs along with associated objects

用本引用更新远程引用

 

Branchy Commands(分支及合并)

 

git checkout

Checkout a branch or paths to the working tree

没什么好说的,Checkout

git branch

List, create, or delete branches

罗列、创建、删掉分支

git merge

Join two or more development histories together

把两个或多个开发历史合并在一起

git rebase

Forward-port local commits to the updated upstream head

怎么说呢,相当于移动分支,使其提交历史的路径发生变化(历史基点改变了)

 

Patchy Commands

 

git diff

Show changes between commits, commit and working tree, etc

比较不同版本的区别

git apply

Apply a patch on a git index file and a working tree

diff的产出(即补丁)应用于文件(传统方式,后面两个命令是邮件方式)

git format-patch

Prepare patches for e-mail submission

把补丁准备成邮件格式

git am

Apply a series of patches from a mailbox

将邮箱收到的补丁邮件信息应用到当前分支(上一步的逆操作)

如果要在windows机器上使用git,还需要下载安装Cygwin。准备试用,但还未实操。如果常用命令的粗释有误,敬请谅解。

 

 

v.s.

unread,
Dec 15, 2009, 11:44:35 PM12/15/09
to Groovy用户组
由于每个命令都有若干选项,因此强烈建议在使用命令前到官方网站上仔细阅读该命令的使用方法
Reply all
Reply to author
Forward
0 new messages