【发布时间】:2013-04-14 05:28:20
【问题描述】:
我经常忘记自己有一些新文件,直接做,
git commit -a -m "My commit message"
这只提交更改的文件,我必须在新提交中添加剩余的文件。这意味着有两个单独的提交,尽管从逻辑上讲它们是同一任务的一部分。
我知道通过两个连续命令在提交中包含未跟踪文件的最简单方法:
git add -A
git commit -a -m "My commit message"
是否可以在一个命令中达到与上述相同的效果?
【问题讨论】:
-
添加未跟踪文件后,为什么不
git commit --amend上一次提交? -
git add -A在手册页中有此消息:If no <pathspec> is given, the current version of Git defaults to "."; in other words, update all files in the current directory and its subdirectories. This default will change in a future version of Git, hence the form without <pathspec> should not be used. -
你可以随时使用
git add -A && git commit -a -m "my message"
标签: git