git commit 指令
September 19, 2020 · View on GitHub
参考资料:
实践总结:
git commit -am相当于git commit -a -mgit commit -a- 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.
- 该指令将修改或删除的改动放入暂存区,注意新文件不会放入暂存区;
git commit -m- Use the given
as the commit message. If multiple -m options are given, their values are concatenated as separate paragraphs. - 该指令将暂存区的改动放入本地仓库(当前分支),如果使用了多个“-m”则会将该提交分成多个段落显示;例如: 使用了
git commit -m "格式统一化" -m "多个注释会怎样?"gitHub上会这样显示: 
- Use the given
git commit 常用指令:
-
git commit -am "注释内容"
- 将 工作区 以及 暂存区 代码放入 本地仓库(不包括工作区新建的文件)
git add -A将所有 工作区 代码放入 暂存区(包括新建的文件)
-
git commit -m "注释内容"
- 将 暂存区 代码放入 本地仓库
-
git commit --amend [-m "xxx"] [--no-edit]
- 将 暂存区 内容再次提交到 本地仓库 ,该改动会添加到前一次
commit中(不产生新的commit);不带 -m 参数则指令执行完将进入 vi 编辑新commit注释界面;(执行该指令前注意先执行git add -A) - 不进入vi编辑,直接用原有提交信息, 带上参数:
--no-edit
- 将 暂存区 内容再次提交到 本地仓库 ,该改动会添加到前一次
相关指令:
-
git_status.md 查看当前代码状态指令: 提交代码到本地仓库后, 用我可以查看有多少个commit等待提交到远程哦!
-
git_push.md 提交代码至远程仓库指令:
git commit后, 接下来就是我git push出场了!