git add和git commit

git命令使用:提交前可指定要提交哪些文件,然后使用git commit来提交

样例:

git status

输出:

Changes to be committed:

modified:   app/Library/Common.php

 

Changes not staged for commit:

modified:   .env

modified:   index.php

 

Untracked files:

.idea/

 

如果你想加入本次要提交的文件,使用命令:git add index.php

然后index.php会出现在Change to be commited一栏下面

 

最后使用git commit -m 'commit message'来提交。

这里一定要注意,千万不能使用:git commit . -m 'commit message'。"git commit ."会把当前的所有修改提交到本地版本库

 

posted on 2017-08-24 11:41  awildfish  阅读(862)  评论(0编辑  收藏  举报

导航