Git 直接提交更改

示例

通常,必须先使用git add或git rm向索引添加更改,然后才能进行更改git commit。传递-a或--all选项以将每个更改(到跟踪的文件)自动添加到索引中,包括删除:

git commit -a

如果您还想添加提交消息,则可以执行以下操作:

git commit -a -m "your commit message goes here"

另外,您可以加入两个标志:

git commit -am "your commit message goes here"

您不必一次提交所有文件。省略-a或--all标志,并指定要直接提交的文件:

git commit path/to/a/file -m "your commit message goes here"

要直接提交多个特定文件,还可以指定一个或多个文件,目录和模式:

git commit path/to/a/file path/to/a/folder/* path/to/b/file -m "your commit message goes here"