尽管使用暂存区域的方式可以精心准备要提交的细节,但有时候这么做略显繁琐。
Git 提供了一个跳过使用暂存区域的方式,只要在提交的时候,给 git commit 加上 -a 选项,Git 就会自动把所有已经跟踪过的文件暂存起来一并提交,从而跳过 git add 步骤:
[code]$ git status
On branch master
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)
modified: benchmarks.rb
no changes added to commit (use “git add” and/or “git commit -a”)
$ git commit -a -m ‘added new benchmarks’
[master 83e38c7] added new benchmarks
1 files changed, 5 insertions(+[/code])
看到了吗?提交之前不再需要 git add 文件 benchmarks.rb 了。
REF:http://cwiki.ossez.com/pages/viewpage.action?pageId=7045474