原理
每个版本控制都把所有的文本保存一遍。
优点:保持数据的完整性。
缺点:占用空间大
三种状态
已管理:
已修改
查看状态 git status
查看日志 git log
显示
-
commit: (分支)
-
author:
-
date(时间):
-
备注显示
管理 git init
说明
生成git目录
管理立即显示
- 多了master分支
- Initialized empty Git repository in
管理之后status
- 分支位置:On branch master
- No commit yet
- Untracked files:(被管理了)
(use “git add …” to include in what will be committed)
红色显示
取消管理
rm -rf .git
添加 git add 文件名
说明
进入暂存区
文件名为. 表示所有的文件夹
提交立即显示
无
添加之后status
changes to be committed:
(use "git rm --cached " to unstaged )
绿色
退回unstaged
git rm --cached 文件名
进入对象区git commit
说明
没有注释,则vim
注释较短 -m "文字"
提交立即显示
-
注释文本
n file changed, n insertions(+), n deletions(-) -
没有要提交的文件:
nothing to commit, working tree clean
修改之后status
进入工作区:changes not staged for commit
modified 文件名 红色