GIT 学习三 (工作区,版本库)

GIT 图

工作区

    使用git init 命令之后,当前文件夹会成为一个GIT 的工作区.

    > mkdir secondgittest

    > git init  // 运行此命令之后 secondgittest 就是一个工作区

    > cat>test.txt  // 创建一个文件

    > git add test.txt  // 将test.txt 放到暂存区(stage)

    > git commit -m "comment" //将暂存区的所有修改提交到分支(master)

使用 git diff HEAD -- test.txt  // 对比版本库和工作区的文件

  撤销工作区的修改

    > git checkout -- file[.]

  撤销暂存区的修改

    > git reset head [file]

  删除 

    > rm 

原文地址:https://www.cnblogs.com/shouwangzhe-/p/4605837.html