git - 是否可以跳过暂存区并(也)将未跟踪的新文件提交给 git?

标签 git git-add git-untracked

是否可以通过单个内置命令行命令跳过暂存区并(同时)将未跟踪的新文件提交给 git?如果没有,有哪些替代方案?

http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository

Providing the -a option to the git commit command makes Git automatically stage every file that is already tracked before doing the commit, letting you skip the git add part:

$ git commit -a -m 'added new benchmarks'

谢谢。

最佳答案

使用单个内置命令行命令?没有。

使用两个命令:

git add -A
git commit

使用自定义别名:

将此添加到 .gitconfig:

[alias]
   commituntracked = "!git add -A; git commit"

然后你可以做

git commituntracked

关于git - 是否可以跳过暂存区并(也)将未跟踪的新文件提交给 git?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16068968/

相关文章:

git commit 修改和未跟踪的内容

混帐 pull "fatal: Uh oh. Your system reports no Git commands at all."

Git:git svn rebase 失败。 RA层请求失败

git - 'git add .' ('git add' 单点) 命令有什么作用?

git - 使用 Git 的 patience diff 算法进行交互式添加

git - BitBucket - 创建存储库和子模块

git diff 不在存储库中的文件与存储库中的文件

java - 将 jar 文件放在供应商/目录中并将其添加到 git 存储库是个坏主意吗?

git - 在 Gitlab 的 Dockerfile 上使用 SSH key - 权限被拒绝