-
git add
:stage the file -
git rm --cached
: unstage the file -
git status :查看当前状态
-
vim readtest: new file
git status 会发现 untracked files : #r readtest
git add readtest : add readtest into the staged area and track it.
readtest会出现在 changes to be committed下 说明已readtest已进入暂存状态 staged
-
vim README.md 做出修改后, :wq 保存退出
-
git status : changes not staged for commit
- git add README.md : to update what has been changed
- git checkout --
: to discard the changes in working directory
$ git mv README.txt README
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD
renamed: README.txt -> README
其实 git mv
运行了三条命令
$ mv README.txt README
$ git rm README.txt
$ git add README