1.git status 查看状态 

git学习笔记(2)添加提交以及查看状态操作                 

On branch master         现在在master分支上  

nothing to commit (create/copy files and use "git add" to track)
因为本地库中没有任何东西,即暂存区中没有东西

2.git add  file 添加到缓存区

按提示创建文件后,再把该文件git add到缓存区

git学习笔记(2)添加提交以及查看状态操作

这样就将good.txt文件添加到了缓存区当中。

然后可以把该文件从缓存去撤回

3.git rm --cached good.txt.将文件从缓存区撤回 

git学习笔记(2)添加提交以及查看状态操作

4.git commit good.txt将文件从缓存区提交到本地仓库

通过git commit good.txt 把该文件提交到本地仓库,

然后会直接进入vim编辑器界面,

加入消息(必须要加)后退出

git学习笔记(2)添加提交以及查看状态操作

注意:git commit -m "my first commit" good.txt 

加入 -m  " " 选项后可以不需要进入vim编辑器

5.修改文件后git状态

提交文件后修改文件前的状态:

git学习笔记(2)添加提交以及查看状态操作

通过vim编辑器修改文件后的状态:

git学习笔记(2)添加提交以及查看状态操作

"git add" and "git commit "

或者是直接git commit -a 文件名

 

 

相关文章:

  • 2021-06-14
  • 2022-02-20
  • 2021-09-05
  • 2022-01-14
  • 2021-11-10
  • 2021-06-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-10-09
  • 2021-12-13
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案