(use "git add <file>..." to include in what will be committed)
sw1.txt
sw2.txt
sw3.txt
nothing added to commit but untracked files present (use "git add" to track)
从
git status
命令的输出中可以得知,工作目录中存在尚未被跟踪的文件,仓库中空无一
物。按照输出提示,需要使用
git add
命令将这些未被跟踪的文件加入仓库。
vagrant@trusty:~/net-auto$
git add sw1.txt
vagrant@trusty:~/net-auto$
git add sw2.txt
vagrant@trusty:~/net-auto$
git add sw3.txt
vagrant@trusty:~/net-auto$
也可以使用
shell
通配符匹配来同时添加多个文件。例如,使用单个命令
git add sw*.txt
来添加所有的交换机配置文件。
使用
git add
将文件加入暂存区之后,再次执行
git status
查看当前状态。
vagrant@trusty:~/net-auto$
git status
On branch master
Initial commit
Changes to be committed: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.