git概念

git 重要的术语概念

术语概念

英文 中文
remote 远程仓库
repository 本地仓库
branch 分支
index/stage/cache 索引区/暂存区/缓存区
workspace 工作区
stash 贮藏区
tag 标签

工作流程


sequenceDiagram
participant workspace
participant stage
participant stash
participant repository
participant remote

par 创建仓库
note over repository: git init
remote ->> repository: git clone
repository ->> workspace: git switch
and 提交修改
workspace ->> stage: git add
stage ->> repository: git commit
repository ->> remote: git push
and 拉取更新
remote ->> repository: git fetch
repository ->> workspace: git merge/rebase
remote ->> workspace: git pull
and 撤销修改
stage ->> workspace: git restore/reset
stage ->> stash: git stash
repository ->> stage: git reset/revert
repository ->> repository: git rebase
end


参考资料

更新日志

  • 20241217:增加阮一峰那经典的流程图,优化展现形式

  • 20241021:时序图增加英文

  • 20211227:初稿