小白 Git 生存指南

2022-04-14  本文已影响0人  JohnYuCN

git 命令较多,使用不得法,伤人伤己,保证活下来!


git生存指南.png

一、最基本概念:

五个存储区:

标准的git提供了五个存储区:

  1. WorkingSpace:
  2. Stage
  3. Stash
  4. Repository
  5. Remote

官网提供原理图:(三个存储区)

image.png

阮一峰提供的原理图 (四个存储区)

同时也提供了几个基础命令,可以参看其技术博客: 常用 Git 命令清单

image.png

三种状态:

将整个【工作区+.git目录】视为被管理对象,其相当于状态机,有三种状态:

  1. 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
  1. staged (已暂存):

表示对工作区的修改已经暂存到了stage中,但并未将stage中的内容做提交时的状态。

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   b.txt
  1. committed(已提交):

表示数据已经安全地保存在本地数据库中。

nothing to commit, working tree clean

二. 我整理的生存图:

整理全部的五个存储区,并覆盖了多数在实践中的常用命令。


git工作流程.drawio (1).png
上一篇 下一篇

猜你喜欢

热点阅读