写完代码或是添加修改文件后,通过git status 命令查看
命令:git status
admin@software:~/workspace/sourcecode/vendor/qcom/proprietary/commonsys/fastmmi$ git status ./
On branch develop
Your branch is up to date with 'origin/develop'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
ReadMe.md
nothing added to commit but untracked files present (use "git add" to track)
admin@software:~/workspace/sourcecode/vendor/qcom/proprietary/commonsys/fastmmi$
把修改好的文件,通过git add 命令进行添加
命令:git add file //添加修改文件
admin@software:~/workspace/sourcecode/vendor/qcom/proprietary/commonsys/fastmmi$ git add ReadMe.md
再次使用git status 命令查看file的状态
admin@software:~/workspace/sourcecode/vendor/qcom/proprietary/commonsys/fastmmi$ git status ./
On branch develop
Your branch is up to date with 'origin/develop'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: ReadMe.md
admin@software:~/workspace/sourcecode/vendor/qcom/proprietary/commonsys/fastmmi$
倘若这个时候文件还想在修改,想撤销刚刚已经git add ReadMe.md 的内容,此时可以对此进行做撤销动作
命令:git reset HEAD
admin@software:~/workspace/sourcecode/vendor/qcom/proprietary/commonsys/fastmmi$ git reset HEAD
git reset HEAD 如果后面什么都不跟的话 就是上一次add 里面的全部撤销了
git reset HEAD XXX/XXX/XXX.java 就是对某个文件进行撤销了