CI校验不通过,竟然被自己坑死了

开发 前端
分享的内容是工作中一些琐碎的事情。记录一下我是如何被git config坑的,导致CI校验竟然不通过。

[[398750]]

大家好,我是TianTian。

分享的内容是工作中一些琐碎的事情。

记录一下我是如何被git config坑的,导致CI校验竟然不通过。

事故由来

当我把bug解决休掉后,顺利跑通后。”愉快“的补完单测,提了个mr,CI校验竟然拦下来了。

图1

当时我的心情是复杂的,于是我点开了这个Details。

看了半天,没有啥有价值的错误信息,接着索性打开这个流水线,看看蓝盾里面具体是哪个子流失线出现了问题,找了半天后,发现了问题。。。

图2

好离谱,为啥我git email尽然有QQ邮箱。。。

为了验证我这个分支是否存在上述的这个问题,我得排查一下:

  1. git log | grep 'Author' | head 

看到结果的时候,我呆滞住了:

图3

居然真的有个commit记录真的是qq邮箱,事情大概清楚了,之前master分支存在问题,我删掉项目,重新拉取一次master分支。

由于我全局配置的git config 是日常邮箱的问题,没有在意这个问题,导致现在CI校验不通过。

那么解决问题的办法就是:

修改下commit历史

如何解决

于是google一个方案,修改 git 历史提交 commit 信息(重写历史),文档链接:

https://www.jianshu.com/p/0f1fbd50b4be

大致意思通过 git rebase 命令,来完成操作:

  1. git rebase -i HEAD~3 
  2. // 修改近三次的信息 

将会得到如下的信息,这里的提交日志是和git log倒叙排列的,我们要修改的日志信息位于第一位:

  1.  1 pick 2275781 should find method from parent 
  2.  2 pick 223fc80 unit test case 
  3.  3 pick 9ac1179 update test case 
  4.  4 
  5.  5 # Rebase 79db0bd..9ac1179 onto 79db0bd (3 commands) 
  6.  6 # 
  7.  7 # Commands: 
  8.  8 # p, pick = use commit 
  9.  9 # r, reword = use commit, but edit the commit message 
  10. 10 # e, edit = use commit, but stop for amending 
  11. 11 # s, squash = use commit, but meld into previous commit 
  12. 12 # f, fixup = like "squash", but discard this commit's log message 
  13. 13 # x, exec = run command (the rest of the line) using shell 
  14. 14 # d, drop = remove commit 
  15. 15 # 
  16. 16 # These lines can be re-ordered; they are executed from top to bottom. 
  17. 17 # 
  18. 18 # If you remove a line here THAT COMMIT WILL BE LOST. 
  19. 19 # 
  20. 20 # However, if you remove everything, the rebase will be aborted. 
  21. 21 # 
  22. 22 # Note that empty commits are commented out 

我们可以根据Commands信息来修改这些信息,来选择我们需要的参数,最后来达到我们的目的。

其他思路

想到我修改的代码,跟主干代码master相差的其实很小,那么我可以做到代码回滚,根据我们的id回退到指定的版本,主要通过的命令就是 git reset,然后选择对于的参数,也能满足我们的需求。

reset的话,通常有三种命令,找了一个不错的文章,分享一下:

https://www.jianshu.com/p/c2ec5f06cf1a

一般来说,有hard,soft,mixed,三种模式,根据不同的场景来做选择。

最后

不说了,我准备写bug去了。

 

责任编辑:姜华 来源: TianTianUp
相关推荐

2020-07-17 09:58:31

Python开发工具

2023-11-12 22:03:25

CanonicalLinuxSnap

2014-05-13 13:01:13

越过AppStore安装应用

2022-04-08 08:48:16

线上事故日志订阅者

2015-08-25 15:58:33

编程集锦

2022-12-15 10:44:35

2020-11-03 06:57:10

MyBatis数据库

2019-09-18 15:20:16

MyBatisSQL数据库

2020-11-08 14:34:31

小视频浏览器

2021-07-16 07:57:35

SpringBootOpenFeign微服务

2009-11-11 09:56:54

北电电信公司

2019-07-25 15:10:11

携号转网业务运营商

2021-09-30 08:40:28

Oracle数据库后端开发

2021-05-10 11:04:46

Windows 操作系统微软

2020-11-24 08:15:09

Elasticsear面试分布式

2018-11-28 09:14:41

交换机网络安防

2021-06-27 21:06:47

开发循环依赖

2021-12-03 06:59:23

操作符验证点属性

2019-12-27 14:00:43

传统IT商业模式

2021-08-18 15:23:42

SDNSD-WAN软件定义网络
点赞
收藏

51CTO技术栈公众号