git 命令较多,使用不得法,伤人伤己,保证活下来!
git生存指南.png
一、最基本概念:
五个存储区:
标准的git提供了五个存储区:
- WorkingSpace:
- Stage
- Stash
- Repository
- Remote
官网提供原理图:(三个存储区)
image.png阮一峰提供的原理图 (四个存储区)
同时也提供了几个基础命令,可以参看其技术博客: 常用 Git 命令清单
三种状态:
将整个【工作区+.git目录】视为被管理对象,其相当于状态机,有三种状态:
- modified(已修改):
表示修改了工作区的文件,但修改后的内容并未同步到stage中的状态:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: b.txt
- staged (已暂存):
表示对工作区的修改已经暂存到了stage中,但并未将stage中的内容做提交时的状态。
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: b.txt
- committed(已提交):
表示数据已经安全地保存在本地数据库中。
nothing to commit, working tree clean
二. 我整理的生存图:
整理全部的五个存储区,并覆盖了多数在实践中的常用命令。
git工作流程.drawio (1).png
网友评论