1.git status 查看状态
On branch master 现在在master分支上
nothing to commit (create/copy files and use "git add" to track)
因为本地库中没有任何东西,即暂存区中没有东西
2.git add file 添加到缓存区
按提示创建文件后,再把该文件git add到缓存区
这样就将good.txt文件添加到了缓存区当中。
然后可以把该文件从缓存去撤回
3.git rm --cached good.txt.将文件从缓存区撤回
4.git commit good.txt将文件从缓存区提交到本地仓库
通过git commit good.txt 把该文件提交到本地仓库,
然后会直接进入vim编辑器界面,
加入消息(必须要加)后退出
注意:git commit -m "my first commit" good.txt
加入 -m " " 选项后可以不需要进入vim编辑器
5.修改文件后git状态
提交文件后修改文件前的状态:
通过vim编辑器修改文件后的状态:
"git add" and "git commit "
或者是直接git commit -a 文件名