three of the most popular
Git
Subversion
Mercurial
Two different caregories类别
- the centralized model集中式模型
- the distributed model分布式模型
命令
# 设置你的 Git 用户名
$ git config --global user.name "<Your-Full-Name>"
# 设置你的 Git 邮箱
$ git config --global user.email "<your-email-address>"
# 确保 Git 输出内容带有颜色标记
$ git config --global color.ui auto
#配置代码编辑器
$ git config --global core.editor <your-editor's-config-went-here>
# 对比显示原始状态
$ git config --global merge.conflictstyle diff3
$ git config --list
Git命令
Git init
Git init:create brand new repositoris from scratch on the computer
init:initialize
所需命令:
- ls - 用来列出文件和目录
- mkdir - 用来新建目录
- cd - 用来更改目录
- rm - 用来删除文件和目录
创建文件的方法:
mkdir udacity-git-course
cd ~/udacity-git-course
mkdir new-git-project
可以用以下命令直接代替
mkdir -p udacity-git-course/new-gitmproject && cd $_
运行git init可以创建隐藏 .git 目录。此 .git 目录是仓库的核心/存储中心
plumbing 底层
porcelain 上层
Git clone
Git clone:copy existing repos from somewhere else to your local computer
克隆仓库的命令是 git clone <url> 。 比如,要克隆 Git 的链接库 libgit2,可以用下面的命令:
$ git clone https://github.com/libgit2/libgit2
如果你想在克隆远程仓库的时候,自定义本地仓库的名字,你可以通过额外的参数指定新的目录名:
$ git clone https://github.com/libgit2/libgit2 mylibgit
这会执行与上一条命令相同的操作,但目标目录名变为了 mylibgit。
git clone --single-branch --branch <branchname> <remote-repo>