G:\mygitea\GitLearn\learn03 master $ git status On branch master nothing to commit, working tree clean
G:\mygitea\GitLearn\learn03 master $ cat readme This is the oldest branch. This is the older branch. This is the young branch. after test, update readme.
G:\mygitea\GitLearn\learn03 master $ vim test.txt 测试 +提交到暂存区
G:\mygitea\GitLearn\learn03 master $ vim readme This is the oldest branch. This is the older branch. This is the young branch. after test, update readme. +add something.
G:\mygitea\GitLearn\learn03 master ± $ git diff --cached diff --git a/readme b/readme index 93d277f..99a1dfa 100644 --- a/readme +++ b/readme @@ -2,3 +2,4 @@ This is the oldest branch. This is the older branch. This is the young branch. after test, update readme. +add something. diff --git a/test.txt b/test.txt index f29dee6..f26d326 100644 --- a/test.txt +++ b/test.txt @@ -1 +1,2 @@ 测试 +提交到暂存区
# 此时将暂存区部分文件恢复成原始的内容,即与HEAD中对应文件内容一致 G:\mygitea\GitLearn\learn03 master ± $ git reset HEAD -- test.txt Unstaged changes after reset: M test.txt
G:\mygitea\GitLearn\learn03 master ± $ git diff --cached # 只有readme文件与HEAD不一致 diff --git a/readme b/readme index 93d277f..99a1dfa 100644 --- a/readme +++ b/readme @@ -2,3 +2,4 @@ This is the oldest branch. This is the older branch. This is the young branch. after test, update readme. +add something.