没有-a选项的git commit会有什么影响? [英] What is the effect of git commit without the -a option?

查看:115
本文介绍了没有-a选项的git commit会有什么影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个命令之间有什么区别?

  git commit -m添加了一个新页面

  git commit -a -m添加了一个新页面

我知道-a选项将会阶段已经被修改和删除的文件,但然后运行它没有-a意味着什么?

解决方案

通过使用 git add git rm



如果在提交时使用 -a 标志,git会自动对所有修改和删除的文件进行处理,而不必使用添加 rm 等。



如果指定 -a ,任何已被修改或删除的文件,但未使用 git add 显式暂存或 git rm 将在提交中被忽略。



正如Dr. Gianluigi Zane Zanettini所说 - -a 的确如此。

不要将 new 文件添加到索引,因此如果您有完全新文件,则不应指望 -a 来广告它们。



http ://www.kernel.org/pub/software/scm/git/docs/git-commit.html


What is the difference between these two commands?

git commit -m "added a new page"

and

git commit -a -m "added a new page"

I know that the -a option will stage files that have been modified and deleted, but then what does running it without the -a mean?

解决方案

You have to explicitly stage changes for commitment by using git add or git rm.

If you use the -a flag when doing a commit, git will automatically stage any modified and removed files without you having to explicitly stage them using add or rm, etc.

If you don't specify -a, any files that have been modified or removed, but not explicitly staged using git add or git rm will be ignored in the commit.

update

As Dr. Gianluigi Zane Zanettini says - -a does not add new files to the index, so if you have completely new files you shouldn't expect -a to ad them.

http://www.kernel.org/pub/software/scm/git/docs/git-commit.html

这篇关于没有-a选项的git commit会有什么影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆