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

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.kler.cn/news/135927.html

相关文章:

  • 安全项目简介
  • 中间件安全:Apache 目录穿透.(CVE-2021-41773)
  • java源码-工程讲解
  • 三十分钟学会zookeeper
  • 软件测试:测试分类
  • 【FFmpeg实战】ffmpeg播放器-音视频解码流程
  • Python如何调用ixchariot进行吞吐量测试
  • mysql数据模型
  • hypermesh学习总结(一)
  • UE 视差材质 学习笔记
  • AIX 系统基线安全加固操作
  • MATLAB程序设计课后作业三、四
  • 【设计模式】聊聊策略模式
  • 碰到一个逆天表中表数据渲染
  • C语言——2.安装并使用VS
  • 力扣刷题-二叉树-二叉树的高度与深度
  • 搭建网关服务器实现DHCP自动分配、HTTP服务和免密登录
  • 【数据结构(三)】单向环形链表和约瑟夫问题(3)
  • trzsz支持文件拖动到终端进行上传,类似lrzsz
  • 后端返回 date 时间日期格式为 UTC 格式字符串,形如 2022-08-11T10:50:31.050+00:00前端如何修改为yyyy-mm-dd
  • 公司电脑文件透明加密、防泄密管理软件系统
  • ASP.NET限流器的简单实现
  • 贝锐蒲公英路由器X4C如何远程访问NAS?
  • 面试官:你能说说常见的前端加密方法吗?
  • 基于单片机16路抢答器仿真系统
  • Ubuntu 22.04安装Rust编译环境并且测试
  • 【运维篇】Redis常见运维命令详解
  • 数据处理生产环境_利用MurmurHash3算法在Spark和Scala中生成随机颜色
  • 今天遇到Windows 10里安装的Ubuntu(WSL)的缺点
  • 搜索引擎ElasticSearch分布式搜索和分析引擎学习,SpringBoot整合ES个人心得