当前位置: 首页 > news >正文

CICD 持续集成与持续交付——git

git使用

[root@cicd1 ~]# yum install -y git[root@cicd1 ~]# mkdir demo[root@cicd1 ~]# cd demo/

初始化版本库

[root@cicd1 demo]# git init

查看状态

[root@cicd1 demo]# git status[root@cicd1 demo]# git status  -s #简化输出

[root@cicd1 demo]# echo test > README.md[root@cicd1 demo]# ls[root@cicd1 demo]# git status -s

[root@cicd1 demo]# git add README.md[root@cicd1 demo]# git status  -s

[root@cicd1 demo]# git config --global user.email "924023742@qq.com"[root@cicd1 demo]# git config --global user.name "hjl"[root@cicd1 demo]# git commit -m "add README.md"

[root@cicd1 demo]# echo hello >> README.md[root@cicd1 demo]# git status -s

[root@cicd1 demo]# git add README.md[root@cicd1 demo]# git status -s

[root@cicd1 demo]# echo world >> README.md[root@cicd1 demo]# git status -s


 

[root@cicd1 demo]# git commit -m "v1"[root@cicd1 demo]# git status -s

[root@cicd1 demo]# git add .[root@cicd1 demo]# git status -s[root@cicd1 demo]# git commit -m "v2"[root@cicd1 demo]# git status -s

忽略隐藏文件

[root@cicd1 demo]# touch .a[root@cicd1 demo]# git status -s

[root@cicd1 demo]# vim .gitignore

[root@cicd1 demo]# git status -s

[root@cicd1 demo]# echo helloworld > test.txt[root@cicd1 demo]# git add test.txt[root@cicd1 demo]# git commit -m "add test.txt"

撤销文件修改

[root@cicd1 demo]# rm -f test.txt[root@cicd1 demo]# git status -s[root@cicd1 demo]# git checkout -- test.txt

取消暂存区文件

[root@cicd1 demo]# git rm test.txt[root@cicd1 demo]# git status  -s[root@cicd1 demo]# git reset HEAD test.txt

版本回退

[root@cicd1 demo]# git rm test.txt[root@cicd1 demo]# git commit -m "delete test.txt"[root@cicd1 demo]# git reflog[root@cicd1 demo]# git reset --hard 110c7e6

github远程代码仓库

登录:https://github.com/

上传公钥

[root@cicd1 ~]# ssh-keygen[root@cicd1 ~]# cat .ssh/id_rsa.pub

推送仓库

[root@cicd1 ~]# cd demo/[root@cicd1 demo]# git branch -M main[root@cicd1 demo]# git remote add origin git@github.com:he-bao/demo.git[root@cicd1 demo]# git remote -v[root@cicd1 demo]# git push -u origin main

克隆仓库

[root@cicd1 ~]# rm -fr demo/[root@cicd1 ~]# git clone git@github.com:he-bao/demo.git[root@cicd1 ~]# cd demo/[root@cicd1 demo]# ls

http://www.lryc.cn/news/236403.html

相关文章:

  • 光纤的跳线和尾纤
  • SQL SERVER 2008安装教程
  • 好莱坞罢工事件!再次警醒人类重视AI监管,人工智能矛盾一触即发!
  • 深度学习系列54:使用 MMDETECTION 和 LABEL-STUDIO 进行半自动化目标检测标注
  • WSL2环境下Debian 12的Docker安装与配置
  • 11 月 11 日 ROS 学习笔记——ROS 架构及概念
  • BSN专网项目介绍:宁波市区块链新型基础设施“甬链”
  • 【数据库表及字段统计SQL】【mysql】【clickhouse】【oracle】
  • 如何分析伦敦金的价格走势预测?
  • 【设计原则篇】聊聊接口隔离原则
  • 自压缩llm 为 超长记忆之随机编码(非进制编码)
  • 苹果怎么互传照片?简单方法总结好了!
  • 【ARM Trace32(劳特巴赫) 使用介绍 2.1 -- TRACE32 Practice 脚本 cmm 脚本学习】
  • 学习指南:如何快速上手媒体生态一致体验开发
  • 037、目标检测-算法速览
  • 【开发流程】持续集成、持续交付、持续部署
  • Linux——编译器gcc/g++、调试器gdb以及自动化构建工具makefilemake详解
  • Android registerForActivityResults使用详解以及实现原理
  • 模拟实现一个Linux中的简单版shell
  • 扩散模型实战(十):Stable Diffusion文本条件生成图像大模型
  • LaTex编写伪代码,并实现根据所在章编号(连字符),例如算法1-1
  • vue.js javascript js判断是值否为空
  • 网页开发如何实现简易页面跳动/跳转,html课堂练习/作业,页面ABC的相互跳转
  • 某大型房地产公司绩效面谈项目成功案例纪实
  • BGP联盟和团体属性实验
  • 代码随想录-刷题第二天
  • DAY59 503.下一个更大元素II + 42. 接雨水
  • 【如何将任何直流电机变成伺服电机】
  • 单片机语音芯片在工业控制中的应用优势
  • 【开源】基于Vue.js的高校实验室管理系统的设计和实现