Git学习笔记(4) — 基本命令
by Elton on 七.22, 2009, under Linux
git init
初始化一个本地目录,加入版本管理
git clone
克隆一个版本库(repository)到一个新的目录
命令格式
1 | git clone [--template=<template_directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o <name>] [-u <upload-pack>] [--reference <repository>] [--depth <depth>] [--] <repository> [<directory>] |
在clone后, 执行不带参数的git fetch的命令将更新远端的任何branches, 而执行不带参数的git pull的命令将merge远程的master branch到当前master branch
rsync://host.xz/path/to/repo.git/
http://host.xz[:port]/path/to/repo.git/
https://host.xz[:port]/path/to/repo.git/
git://host.xz[:port]/path/to/repo.git/
git://host.xz[:port]/~user/path/to/repo.git/
ssh://[user@]host.xz[:port]/path/to/repo.git/
ssh://[user@]host.xz/path/to/repo.git/
ssh://[user@]host.xz/~user/path/to/repo.git/
ssh://[user@]host.xz/~/path/to/repo.git
其中ssh是默认协议,所以如果使用ssh协议可以不写ssh的协议名
如果使用本地仓库,可以使用以下路径:
/path/to/repo.git/
file:///path/to/repo.git/
使用以上仓库路径,就相当于显式的使用了-l或-local参数
参考:
Everyday GIT With 20 Commands Or So


