git修改commit日志

由于公司对版本提交日志进行检查,如果不符合要求,则push失败。

以下是修改commit日志的方法:

1.进入到提交代码文件所在目录,即git所在目录下

bash 复制代码
cd app-repository

2.git log

bash 复制代码
git log
commit bf29e3e5e799d364fe2975677baf18c9186a242c
Author: ruiliu <ruiliu@asiainfo.com>
Date:   Fri Aug 4 10:09:51 2023 +0800

    [tag]:[tag新版本]

commit c9e7d47d00562facdaae10882610723ee8f5c1f0
Author: ruiliu <ruiliu@asiainfo.com>
Date:   Wed Aug 2 23:10:49 2023 +0800

    update


    Merge remote-tracking branch 'origin/master'

3.发现是,第2条,不符合规范,导致后来符合规范的提交也提交不上去

执行 git rebase -i HEAD~2

bash 复制代码
# git rebase -i HEAD~2
Stopped at c9e7d47... update
You can amend the commit now, with

	git commit --amend

Once you are satisfied with your changes, run

	git rebase --continue

进入到rebase流程。

按照提示的流程继续执行

4.git commit --amend

bash 复制代码
# git commit --amend
[detached HEAD f0eccc8] [tag]:[新版本]
 1 file changed, 10 insertions(+)

会显示很多命令,我们是要修改,所以将命令参数改为 e

5.git rebase --continue

bash 复制代码
git rebase --continue
# Successfully rebased and updated refs/heads/master.

6.git log 再次查看,已经修改完成

bash 复制代码
git log
commit 82856b8b9139d51384eabb073e3e1a46c3824b69
Author: ruiliu <ruiliu@asiainfo.com>
Date:   Fri Aug 4 10:09:51 2023 +0800

    [tag]:[新版本]

commit f0eccc89e2083987fe812f72e1b099df4dd9eeaf
Author: ruiliu <ruiliu@asiainfo.com>
Date:   Wed Aug 2 23:10:49 2023 +0800

    [tag]:[新版本]



    Merge remote-tracking branch 'origin/master'

7.重新push下,即可

bash 复制代码
# ./git-auto-commit-total.sh
git pull no1
From http://哈哈哈哈哈哈哈app-repository
 * branch            HEAD       -> FETCH_HEAD
Already up-to-date.

正在做哈哈哈哈的提交操作
[master f1af787] [tag]:[修改页面格式]
 1 file changed, 10 insertions(+)
# On branch master
nothing to commit, working directory clean
Counting objects: 15, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.06 KiB | 0 bytes/s, done.
Total 12 (delta 9), reused 0 (delta 0)
To http://哈哈哈哈app-repository.git
   91d1505..f1af787  master -> master
完成哈哈哈哈的提交操作
=======================================================
相关推荐
GlobalInfo40 分钟前
AI与另类数据融合,市场研究正在从“经验驱动”走向“数据智能”
大数据·网络·人工智能·ai
新点一讯1 小时前
聚焦流程数智升级,九科信息企业自动化智能体赋能高效运营
大数据·人工智能
美狐美颜sdk1 小时前
直播APP开发完整流程:需求规划、UI设计、功能开发、美颜SDK接入全解析
大数据·人工智能·音视频·美颜sdk·美颜api
小码哥哥2 小时前
当企业软件开始“越界“:从单一工具到超级集合的架构演进
大数据·人工智能·架构
其美杰布-富贵-李2 小时前
05 多分类任务中的评估指标:Binary Metrics 如何扩展到 Multi-class?
大数据·人工智能·分类
珐恩AI-人工智能2 小时前
生成式引擎优化(GEO)全解:2026年AI检索时代企业长效流量运营方法论
大数据·人工智能·产品运营·流量运营·geo优化
天天爱吃肉82182 小时前
【工程师笔记|新能源整车电控一次过CISPR25/BCI,汽车EMC/EMI落地十大核心设计技巧】
大数据·人工智能·笔记·python·汽车
单词记忆方法研究3 小时前
探索上海背单词小程序品牌:高效学习工具的优化之路
大数据·学习·小程序
2601_957879333 小时前
没有视频团队的跨境电商,如何利用AI建立短视频内容生产体系?
大数据·人工智能
扶苏10023 小时前
同一个 Git 项目整出两份,切分支互不影响?两种方案实测
大数据·git·elasticsearch