使用bash脚本提交git自带注释信息

背景:每次提交git,都要写注释,有些情况注释不太好写,或者根本没有必要写,这时可以通过自动加注释方法,比如可以追加修改了哪些文件

解决:通过shell脚本,在脚本里面写git命令,add commit push 等等,commit时获取git的status,参照下面脚本。

#!/bin/bash
 
#execute git command
note=`git status`
git status
git add .
git commit -am "$note"
git pull --rebase
git push
#! /bin/bash

note=`git status`
git commit -m "$note"
git push

通过git log,就能查看刚提交的日志,能看到修改了哪些文件。

当然你想带的信息都可以加进去,便于后续排查方便,git有根据日志查询的功能。

转自:https://www.cnblogs.com/xiaogangfan/p/9100421.html

猜你喜欢

转载自blog.csdn.net/qq_45467083/article/details/109688959
今日推荐