提交变更(git commit)

当所有的变更都进入暂存区,就可以使用git commit进行提交了

$ git commit

执行这句话后,会弹出文本编辑区(自己配置的或默认的),文本编辑器可能会显示如下内容


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Changes to be committed:
#   modified:   main.c
#

如果加上-v开关,会把更改的详细内容加入


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Changes to be committed:
#   modified:   main.c
#
# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
diff --git a/main.c b/main.c
index e69de29..a865187 100644
--- a/main.c
+++ b/main.c
@@ -0,0 +1 @@
+Modify the first line of main.c

这里你可以输入一些修改的被指。以#开头的是注释,在最终提交中会被忽略,当然你也可以取消注释作为备注的一部分。

如果在命令行里,可以直接通过-m开关加入备注

$ git commit -m "my first commit!"
[master 4be71fb] my first commit!
 1 file changed, 1 insertion(+)

输出中包括了和该提交本身相关的一些信息:提交到了那个分支(master),提交的SHA-1校验和是多少(4be71fb)、改动了多少个文件以及源文件新增和删除了多少行的统计信息。

开关

-a开关将会把所有更改提交到暂存区,然后提交
-m "提交备注"直接输入提交的备注

转载于:https://www.cnblogs.com/velscode/p/10585013.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值