编写git提交消息

时间:2013-12-26 04:40:06

标签: git

撰写提交邮件时,git -m "message"git commit -am "message"

之间的区别是什么

一直在听一个教程而且这个家伙没有清楚地解释两者之间的区别

3 个答案:

答案 0 :(得分:1)

-a标志会将所有当前跟踪的文件添加到提交中。它不会添加新文件。它与消息无关。

来自man page

-a
--all
Tell the command to automatically stage files that have been modified and 
deleted, but new files you have not told git about are not affected.

答案 1 :(得分:1)

通常你会做

//tell git to stage all the files
git add . 

//now commit all the staged files with this message
git commit -m "message"


//Assuming you have just modified existing files in git repo.. you could use this as a shortcut
git commit -am "message"

//meaning, stage all the modified files and commit with this message.

答案 2 :(得分:1)

git -m message添加了当前添加的文件和给定消息的提交,而git -am message添加了所有跟踪的文件,然后提交当前消息。

您可以阅读有关adding files to your repository here

的更多信息