侧边栏壁纸
博主头像
DJ's Blog博主等级

行动起来,活在当下

  • 累计撰写 133 篇文章
  • 累计创建 51 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

【Gitlab】常见操作

Administrator
2022-03-07 / 0 评论 / 0 点赞 / 67 阅读 / 1551 字

【Gitlab】常见操作

代码回滚到特定版本

  • 用命令行打开git项目路径,输入git log命令查看commit记录
git log
commit c085b6a01d0521177ea0b80262a9caff9c021e34 
Author: wuxingle <1546752823@qq.com>
Date:   Thu Feb 25 08:45:03 2021 +0800

    恢复网商和平安真实余额查询

commit a2476e8a41a289200d1f083218fc2a8c8b66c708
Author: wuxingle <1546752823@qq.com>
Date:   Wed Feb 24 15:42:14 2021 +0800

    修改批次查询时排序

commit 0df4afbd99bc3fde8e519cd8aad517e0a2b6d3d1
Author: daijiong <daijiong@successhr.com>
Date:   Wed Feb 24 15:04:50 2021 +0800
  • 找到需要回滚的commit,输入git reset --hard {commitId},将本地文件回滚
git reset --hard c085b6a01d0521177ea0b80262a9caff9c021e34
HEAD is now at c085b6a0 恢复网商和平安真实余额查询
  • 此时本地文件已经回滚到刚刚commit c085b6a01d0521177ea0b80262a9caff9c021e34之后的状态,但是服务器仍然没有改变,需要继续远程回滚
git push -f
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for hotfix_20210222_bugfix, visit:
remote:   http://gitlab.ukerw.com/ukerw/uker-psp/-/merge_requests/new?merge_request%5Bsource_branch%5D=hotfix_20210222_bugfix
remote:
To http://gitlab.ukerw.com/ukerw/uker-psp.git
 + 75ba6387...c085b6a0 hotfix_20210222_bugfix -> hotfix_20210222_bugfix (forced update)
0

评论区