git命令总结
[toc]
1.git简介
1.1 git工作流程
1.2 git四种状态
2.git命令总结
2.1 git工作区域及文件颜色
git status 文件三种颜色的变化
红色- 新增文件或者修改的旧文件-->执行命令
git add .
或 者git add 文件名
- git已经管理起来的文件-->执行命令
git commit -m '描述信息'
白色
- 已经生成版本的文件
2.2 git提交数据
创建文件
$ touch aaa bbb
查看git文件状态(此时文件是红色的,属于新增文件)
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
aaa
bbb
nothing added to commit but untracked files present (use "git add" to track)
提交文件至暂存区
$ git add .
此时再查看文件,文件是绿色的,已被git管理起来
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: aaa
new file: bbb