git基本命令解析
代码片
.
// 设置提交代码时的用户信息
git config [--global] user.name "name"
git config [--global] user.email "[email address]"
步骤 | 命令 | 解释 |
---|---|---|
1 | git init | 在当前目录新建一个Git代码库 |
2 | git add [file1] | 添加指定文件到暂存区 |
3 | git add . | 添加当前目录的所有文件到暂存区 |
4 | git commit [file1] [file2] … -m [message] | 提交暂存区的指定文件到仓库区 |
5 | git commit -m [message] | 提交当前目录的所有文件到暂存区到仓库区 |
6 | git push -u origin master | 初次关联远程仓库以后用 |
7 | git push | 将会关联到远程的master 分支上,以后就可以git push不指定参数了 |