Git快速查找笔记

起步

三个配置文件

git config --system:文件位置/etc/gitconfig,系统级配置
git config --global:文件位置~/.gitconfig~/.config/git/config 文件,当前用户配置
.git/config:文件位置仓库.git/config,当前仓库配置

用户信息配置

1
2
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

查看配置

git config --list:列出所有 Git 当时能找到的配置

获取帮助

1
2
3
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
阅读更多

Git checkout指定tag的代码

有时候,想要拉取特定标签的代码,比如说1.0.0标签名的代码?

clone

1
$ git clone

先使用git clone克隆这个代码仓库。

checkout

1
2
$ git tag -l
$ git checkout tags/<tag_name>

克隆完代码仓库后,通过检出特定标签的代码。

创建分支

1
$ git checkout tags/<tag_name> -b <branch_name>

更好的方法,检出代码后创建一个新的分支,否则你将会在一个用标签版本号命名的分支上。

参考

Download a specific tag with Git