Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
Git tracks changes offiles.
My stupid boss still prefers SVN.
还好没有提交,现在,看一下status和diff
git status
On branch master
Changes not staged for commit:
(use"git add <file>..."to update what will be committed)
(use"git checkout -- <file>..."to discard changes in working directory)
modified: readme
no changes added to commit (use"git add"and/or"git commit -a")
git diff readme
diff --git a/readme b/readme
index a9c5755..533f857 100644--- a/readme
+++ b/readme
@@ -2,3 +2,4 @@ Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
Git tracks changes offiles.
+My stupid boss still prefers SVN.
Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
Git tracks changes offiles.
My stupid boss still prefers SVN.
git add readme
查看一下状态
git status readme
On branch master
Changes to be committed:
(use"git reset HEAD <file>..."to unstage)
modified: readme
从暂存区中撤销
git reset HEAD readme
Unstaged changes after reset:
M readme
再从工作区中撤销
gitcheckout--readme
完成。。。。
小结:使用reset HEAD file可以从暂存区中撤销,使用git checkout – file 可以从工作区中撤销
假设,假设,不过现在是凌晨两点,你正在赶一份工作报告,你在readme.txt中添加了一行:Git is a distributed version control system.Git is free software distributed under the GPL.Git has a mutable index called stage.Git tracks changes of