## 查看Git当前的状态
[root@node31 git_test]# git status # On branch master # # Initial commit # nothing to commit (create/copy files and use "git add" to track)
## 创建一个新文件,看一看状态
[root@node31 git_test]# touch chenliang.txt [root@node31 git_test]# ll chenliang.txt -rw-r--r-- 1 root root 0 Feb 19 07:25 chenliang.txt [root@node31 git_test]# [root@node31 git_test]# git status # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # chenliang.txt nothing added to commit but untracked files present (use "git add" to track)
## 让其chenliang.txt文件被git跟踪
[root@node31 git_test]# git add chenliang.txt [root@node31 git_test]# git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: chenliang.txt # [root@node31 git_test]#
## 将暂存区中的文件提交到本地仓库
[root@node31 git_test]# git commit -m "empty file chenliang.txt" [master (root-commit) 94902bc] empty file chenliang.txt 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 chenliang.txt
## 再查看一下git的状态
[root@node31 git_test]# git status # On branch master nothing to commit, working directory clean