1. 添加文件到仓库(git add)
用命令git add告诉Git,把文件添加到仓库:
$ git add readme.txt
可反复多次使用,添加多个文件;
2. 提交文件到仓库(git commit)
- 用命令
git commit告诉Git,把文件提交到仓库:
$ git commit -m "wrote a readme file"
[master (root-commit) cb926e7] wrote a readme file
1 file changed, 2 insertions(+)
create mode 100644 readme.txt
修改 commit 信息
git commit --amendgit commit -a会自动把所有已经跟踪过的文件暂存起来一并提交,从而跳过 git add 步骤git commit -a -m 'added new benchmarks'
3. 查看工作区的状态
git status
4. 工作区 & 暂存区 & 版本库
