git status 查看状态
git status 查看在你上次提交之后是否有修改。
$ git statusOn branch masterChanges 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: index.txtno changes added to commit (use "git add" and/or "git commit -a")
参数
- -s:短格式输出
git diff
执行 git diff 来查看执行 git status 的结果的详细信息。
$ git diffdiff --git a/index.txt b/index.txtindex b2d525b..9472f1c 100644--- a/index.txt+++ b/index.txt@@ -1 +1,2 @@-index\ No newline at end of file+index+first\ No newline at end of file
git rm
要从 Git 中移除某个文件,就必须要从已跟踪文件清单中移除,然后提交。
$ git rm index.txtrm 'index.txt'$ git commit -m "del"[master f2ca9d9] del1 file changed, 2 deletions(-)delete mode 100644 index.txt
参数:
- -f:强制
- -r:递归删除,删除子文件夹
git mv
git mv 命令用于移动或重命名一个文件、目录、软连接。
$ git mv readme.txt readme.md
