更新时间:2022-05-01 06:04:18
Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ vim a.txt Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ vim a.txt Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ git status On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) a.txt nothing added to commit but untracked files present (use "git add" to track) Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ git status -s ?? a.txt
①. git add 将未跟踪的文件加入暂存区(将新创建的文件加入暂存区后查看文件状态)
②. git add .(.代表所有新增、修改)
③. git add -A( -A 新增、修改、删除)推荐使用
④. git reset 将暂存区的文件取消暂存(将文件取消暂存后查看文件状态)
$ git add a.txt warning: LF will be replaced by CRLF in a.txt. The file will have its original line endings in your working directory Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: a.txt Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ git reset a.txt Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master) $ git status On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) a.txt nothing added to commit but untracked files present (use "git add" to track) Administrator@SD-20191128LXMQ MINGW64 /d/gitRepos/repo1 (master)