Linux学习-HIS系统部署(1)

Git安装
#安装中文支持(选做)
[root@Programer ~]# echo $LANG                              #查看当前系统语言及编码
en_US.UTF-8
[root@Programer ~]# yum -y install langpacks-zh_CN.noarch   #安装中文支持
[root@Programer ~]# vim /etc/locale.conf                    #配置系统使用中文及编码
[root@Programer ~]# cat /etc/locale.conf 
LANG="zh_CN.UTF-8"
[root@Programer ~]# reboot                                  #重启使语言配置生效[root@Programer ~]# echo $LANG                              #确认使用中文编码
zh_CN.UTF-8
[root@Programer ~]# #yum源中集成了Git软件包,使用yum安装Git
[root@Programer ~]# yum clean all; yum repolist -v          #插件yum源是否可用
...
Total packages: 8,265
[root@Programer ~]# yum -y install git                      #使用yum安装Git
...
Complete!
[root@Programer ~]# git --version                           #查看Git版本
git version 2.31.1
[root@Programer ~]# git --help                              #查看Git命令帮助信息
Git工作流程

在这里插入图片描述

Git基础配置
# Git基础配置
--local:仓库级
--global:全局级
--system:系统级
# 设置用户名
[root@programer ~]# git config --global user.name xuwenpeng3
# 设置用户信箱
[root@programer ~]# git config --global user.email xuwenpeng3@163.com
# 设置版本库默认分支
[root@programer ~]# git config --global init.defaultBranch master
# 查看已有Git配置
[root@programer ~]# git config --list
user.name=xuwenpeng3
user.email=xuwenpeng3@163.com
init.defaultbranch=master
# 查看Git配置持久化文件
[root@programer ~]# cat ~/.gitconfig 
[user]name = xuwenpeng3email = xuwenpeng3@163.com
[init]defaultBranch = master
Git创建版本库
# ------Git初始化空版本库
[root@programer ~]# ls
# 初始化空版本库
[root@programer ~]# git init myproject
Initialized empty Git repository in /root/myproject/.git/
[root@programer ~]# ls
myproject
# 查看版本库信息
[root@programer ~]# ls -a myproject/
.  ..  .git
[root@programer ~]# ls -a myproject/.git
.  ..  HEAD  branches  config  description  hooks  info  objects  refs
# ------将已胡目录制作成版本库
[root@programer ~]# mkdir mytest
[root@programer ~]# ls -a mytest
.  ..
[root@programer ~]# cd mytest
# 将已有空的目录初使化为git库
[root@programer mytest]# git init
Initialized empty Git repository in /root/mytest/.git/
[root@programer mytest]# ls -a
.  ..  .git
[root@programer mytest]# ls -a .git
.  ..  HEAD  branches  config  description  hooks  info  objects  refs
Git版本库操作
# Git基础命令使用
[root@programer ~]# cd myproject/
[root@programer myproject]# git status
On branch masterNo commits yetnothing to commit (create/copy files and use "git add" to track)
# 创建readme文件
[root@programer myproject]# echo "Learning Git" >> readme.md
[root@programer myproject]# ls
readme.md
[root@programer myproject]# git status
On branch masterNo commits yetUntracked files:(use "git add <file>..." to include in what will be committed)readme.mdnothing added to commit but untracked files present (use "git add" to track)
# 将文件信息添加到暂存区
[root@programer myproject]# git add readme.md 
# 查看Git本地仓库状态
[root@programer myproject]# git status
On branch masterNo commits yetChanges to be committed:(use "git rm --cached <file>..." to unstage)new file:   readme.md
# 将暂停区文件提交到本地仓库
[root@programer myproject]# git commit -m "add readme"
[master (root-commit) 6c7fa0a] add readme1 file changed, 1 insertion(+)create mode 100644 readme.md
[root@programer myproject]# git status
On branch master
nothing to commit, working tree clean
Git版本库查询
# 查看本地Git版本库信息
[root@programer myproject]# git log      # 本地版本库提交记录
commit 6c7fa0a66645eb2dfa9c9f75f0cb1237b39a9489 (HEAD -> master)
Author: xuwenpeng3 <xuwenpeng3@163.com>
Date:   Wed Sep 20 10:18:02 2023 +0800add readme
# 本地版本库提交记录(简略)
[root@programer myproject]# git log --pretty=oneline
6c7fa0a66645eb2dfa9c9f75f0cb1237b39a9489 (HEAD -> master) add readme
# 本地版本库提交记录(极简)
[root@programer myproject]# git log --oneline
6c7fa0a (HEAD -> master) add readme
Git练习(生成多个版本)
[root@programer ~]# cd myproject
# 创建test.txt文件
[root@programer myproject]# echo 123 > test.txt
# 添加test.txt至暂存区
[root@programer myproject]# git add test.txt
# 生成新版本
[root@programer myproject]# git commit -m "add test.txt"
[master f20ee5f] add test.txt1 file changed, 1 insertion(+)create mode 100644 test.txt
[root@programer myproject]# echo 456>test.txt[root@programer myproject]# git add .
[root@programer myproject]# git commit -m "modify test.txt"
[master e88a5ff] modify test.txt1 file changed, 1 deletion(-)
[root@programer myproject]# echo 789 > test.txt
[root@programer myproject]# git commit -m "done test.txt"
On branch master
Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified:   test.txtno changes added to commit (use "git add" and/or "git commit -a")
[root@programer myproject]# git add ./
[root@programer myproject]# git commit -m "done test.txt"
[master d4a95fa] done test.txt1 file changed, 1 insertion(+)
[root@programer myproject]# git log --pretty=oneline
d4a95face5c9725263596ff340dcf9f2dd0e2552 (HEAD -> master) done test.txt
e88a5ff574fd24416de7e5834f5ef2144502f8dc modify test.txt
f20ee5f0034d7866381dcdd14bc09168f4563b0f add test.txt
6c7fa0a66645eb2dfa9c9f75f0cb1237b39a9489 add readme
[root@programer myproject]# git log --oneline
d4a95fa (HEAD -> master) done test.txt
e88a5ff modify test.txt
f20ee5f add test.txt
6c7fa0a add readme
Git指针操作
查看Git指针信息
# 使用git log命令查看HEAD指针
[root@programer ~]# cd myproject
# 查看git指针
[root@programer myproject]# git log --pretty=oneline
d4a95face5c9725263596ff340dcf9f2dd0e2552 (HEAD -> master) done test.txt
e88a5ff574fd24416de7e5834f5ef2144502f8dc modify test.txt
f20ee5f0034d7866381dcdd14bc09168f4563b0f add test.txt
6c7fa0a66645eb2dfa9c9f75f0cb1237b39a9489 add readme
[root@programer myproject]# cat test.txt
789
利用指针实现Git版本还原
# reset子命令用于版本还原
--soft:缓存区和工作目录不受影响,reset后分支和HEAD指针移动到指定的commit,代码文件和reset之前一样,修改部分已加入到暂存区,通常用于重新提交。
--mixed:(默认)工作目录不受影响,reset后分支的HEAD指针移动到指定位置,代码文件内容和reset之前一样,修改部分未加入到暂存区
--hard:工作目录,缓存区均受影响。reset后分支和HEAD指针移动到指定commit,代码文件内容回退到指定commit,工作空间为clean状态。通常用于获取指定版本的代码文件
# 还原到指定版本
[root@programer myproject]# git reset --hard 1c2535a7c2 
HEAD is now at 1c2535a modify test.txt
# 确认HEAD指针移动
[root@programer myproject]# git log --oneline
1c2535a (HEAD -> master) modify test.txt
5dc6adb add test.txt
023dbd9 add readme
[root@programer myproject]# cat test.txt
456#reflog子命令用于获取HEAD指针移动轨迹
[root@programer myproject]# git reflog
1c2535a (HEAD -> master) HEAD@{0}: reset: moving to 1c2535a7c2
dc4b5a8 HEAD@{1}: commit: done test.txt
1c2535a (HEAD -> master) HEAD@{2}: commit: modify test.txt
5dc6adb HEAD@{3}: commit: add test.txt
023dbd9 HEAD@{4}: commit (initial): add readme
[root@programer myproject]# git reflog
dc4b5a8 (HEAD -> master) HEAD@{0}: reset: moving to dc4b5a8
1c2535a HEAD@{1}: reset: moving to 1c2535a7c2
dc4b5a8 (HEAD -> master) HEAD@{2}: commit: done test.txt
1c2535a HEAD@{3}: commit: modify test.txt
5dc6adb HEAD@{4}: commit: add test.txt
023dbd9 HEAD@{5}: commit (initial): add readme
[root@programer myproject]# cat test.txt 
789
Git分支操作
# 查看当前分支信息,branch子命令
# 查看本地Git仓库信息
[root@programer myproject]# git status
On branch master
nothing to commit, working tree clean
# 查看分支信息
[root@programer myproject]# git branch -v
* master dc4b5a8 done test.txt
# 创建hotfix分支
[root@programer myproject]# git branch hotfix
[root@programer myproject]# git branch feature
[root@programer myproject]# git branch -vfeature dc4b5a8 done test.txthotfix  dc4b5a8 done test.txt
* master  dc4b5a8 done test.txt
# 切换分支
[root@programer myproject]# git checkout hotfix
Switched to branch 'hotfix'
[root@programer myproject]# git branch -vfeature dc4b5a8 done test.txt
* hotfix  dc4b5a8 done test.txtmaster  dc4b5a8 done test.txt
[root@programer myproject]# git checkout feature
Switched to branch 'feature'
[root@programer myproject]# git branch -v
* feature dc4b5a8 done test.txthotfix  dc4b5a8 done test.txtmaster  dc4b5a8 done test.txt
[root@programer myproject]# git branch develop
[root@programer myproject]# git branch -vdevelop dc4b5a8 done test.txt
* feature dc4b5a8 done test.txthotfix  dc4b5a8 done test.txtmaster  dc4b5a8 done test.txt
# 删除develop分支
[root@programer myproject]# git branch -d develop
Deleted branch develop (was dc4b5a8).
[root@programer myproject]# git branch -v
* feature dc4b5a8 done test.txthotfix  dc4b5a8 done test.txtmaster  dc4b5a8 done test.txt
Git合并分支
# 无冲突分支合并
# 切换到hotfix分支
[root@programer myproject]# git checkout hotfix
Switched to branch 'hotfix'
[root@programer myproject]# echo haha>haha.txt
# 添加haha到暂存区
[root@programer myproject]# git add .
# 生成新版本
[root@programer myproject]# git commit -m "add haha.txt"
[hotfix 49461bb] add haha.txt1 file changed, 1 insertion(+)create mode 100644 haha.txt
[root@programer myproject]# ls
haha.txt  readme.md  test.txt
# 切换到master分支
[root@programer myproject]# git checkout master
Switched to branch 'master'
[root@programer myproject]# echo xixi>xixi.txt
#添加至暂存区
[root@programer myproject]# git add .
[root@programer myproject]# git commit -n "add xixi.txt"
error: pathspec 'add xixi.txt' did not match any file(s) known to git
[root@programer myproject]# git commit -m "add xixi.txt"
[master fd88497] add xixi.txt1 file changed, 1 insertion(+)create mode 100644 xixi.txt
[root@programer myproject]# git branch -vfeature dc4b5a8 done test.txthotfix  49461bb add haha.txt
* master  fd88497 add xixi.txt
# 合并hotfix分支到master分支
[root@programer myproject]# git merge hotfix
Merge made by the 'recursive' strategy.haha.txt | 1 +1 file changed, 1 insertion(+)create mode 100644 haha.txt
[root@programer myproject]# ls
haha.txt  readme.md  test.txt  xixi.txt
[root@programer myproject]# cat haha.txt
haha
[root@programer myproject]# cat xixi.txt
xixi
[root@programer myproject]# git checkout hotfix
Switched to branch 'hotfix'
[root@programer myproject]# echo "hahaha">a.txt
[root@programer myproject]# git add .
[root@programer myproject]# git commit -m "hotfix"
[hotfix 3be70ac] hotfix1 file changed, 1 insertion(+)create mode 100644 a.txt
[root@programer myproject]# git branch -vfeature dc4b5a8 done test.txt
* hotfix  3be70ac hotfixmaster  416f3d7 Merge branch 'hotfix'
[root@programer myproject]# git checkout master
Switched to branch 'master'
[root@programer myproject]# git branch -vfeature dc4b5a8 done test.txthotfix  3be70ac hotfix
* master  416f3d7 Merge branch 'hotfix'
[root@programer myproject]# echo "xixixi">a.txt
[root@programer myproject]# git add .
[root@programer myproject]# git commit -m "master"
[master 93e8350] master1 file changed, 1 insertion(+)create mode 100644 a.txt# 有冲突分支合并(修改不同分支中相同文件的相同行)
[root@programer myproject]# git merge hotfix
CONFLICT (add/add): Merge conflict in a.txt
Auto-merging a.txt
Automatic merge failed; fix conflicts and then commit the result.
[root@programer myproject]# cat a.txt
<<<<<<< HEAD
xixixi
=======
hahaha
>>>>>>> hotfix
# 将a.txt文件内容合并成如下
[root@programer myproject]# vim a.txt
xixixi
hahaha
[root@programer myproject]# git add .
[root@programer myproject]# git commit -m "resolv conflict"
[master a35cf84] resolv conflict
[root@programer myproject]# 
Git标签操作
# 使用tag子命令管理标签
# 查看已有标签
[root@programer myproject]# git tag
# 创建v1标签
[root@programer myproject]# git tag v1
[root@programer myproject]# git tag
v1
[root@programer myproject]# git tag v2
[root@programer myproject]# git tag
v1
v2
# 删除v2标签
[root@programer myproject]# git tag -d v2
Deleted tag 'v2' (was a35cf84)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/139988.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

差值结构的顺序偏好

( A, B )---3*30*2---( 1, 0 )( 0, 1 ) 让网络的输入只有3个节点&#xff0c;AB训练集各由5张二值化的图片组成&#xff0c;让A 中有5个点&#xff0c;B中有1个点&#xff0c;且不重合&#xff0c;统计迭代次数并排序。 第一种情况 差值结构 迭代次数 L E - - 2 10491.…

python随手小练1

题目&#xff1a; 使用python做一个简单的英雄联盟商城登录界面 具体操作&#xff1a; print("英雄联盟商城登录界面") print("~ * "*15 "~") #找其规律 a "1、用户登录" b "2、新用户注册" c "3、退出系统&quo…

手动部署 OceanBase 集群

手动部署一个 OB 单副本集群&#xff0c;包括一个 OBProxy 节点 部署环境 服务器信息 IP地址 192.168.0.26 网卡名 ifcfg-enp1s0 OS Kylin Linux Advanced Server release V10 CPU 8C 内存 32G 磁盘1 本地盘 /data/1 磁盘2 本地盘 /data/log1 机器和角色划分 …

es小记(copy_to)

简单创建索引复制字段 1: 3个主分片,各自有一个副本,总分片数为 3*26; refresh_interval为刷新频率; 其他参数描述,转载自 PUT test1 { “settings”:{ “number_of_shards”: 1, “number_of_replicas”: 1, “refresh_interval”: “30s” }, “mappings”:{ “properties”…

软件工程知识总结梳理

&#x1f525;&#x1f525;宏夏Coding网站&#xff0c;致力于为编程学习者、互联网求职者提供最需要的内容&#xff01;网站内容包括求职秘籍&#xff0c;葵花宝典&#xff08;学习笔记&#xff09;&#xff0c;资源推荐等内容。在线阅读&#xff1a;https://hongxiac.com&…

ubuntu20.04 安装 pyconcorde

这个包似乎对网络环境要求挺高的&#xff0c;我们直接弄个 射线A型号 的飞机 直接使用 pip install pyconcorde 安装&#xff0c;发现在使用里面的包时会报奇怪的错误&#xff0c;于是决定寻找 github 上的 pyconcorde 源码&#xff0c;看文档进行安装 github 地址&#xff1…

计算π的近似值分数 ——python

利用格里高利公式&#xff1a; 计算 的近似值&#xff0c;直到最后一项的绝对值小于给定精度eps。 输入格式: 输入小于1且大于0的阈值。 输出格式: 输出满足阈值条件的近似圆周率&#xff0c;输出到小数点后6位。 输入样例: 在这里给出一组输入。例如&#xff1a; 0.0…

分布式锁演进-基本原理与使用

文章目录 前言一、分布式锁演进1.1 分布式锁特点1.2 阶段一1.3 阶段二1.4 阶段三1.5 阶段四 前言 在单体应用下当多线程去竞争某一共享资源时&#xff0c;我们通常会用一把锁来保证只有一个线程获取到资源。如加上 synchronize 关键字或 ReentrantLock 锁等操作。 在分布式应用…

一篇文章让你学会什么是哈希

一篇文章让你学会什么是哈希 哈希概念哈希冲突哈希函数1. 直接定址法2. 除留余数法3. 平方取中法4. 折叠法5. 随机数法6. 数学分析法 哈希冲突解决1. 闭散列1.1 线性探测1.2 二次探测 2. 开散列 开散列和闭散列对比 哈希概念 哈希在C中有广泛的应用&#xff0c;它是一种用于快…

pytest框架前后置设置,以及pytest默认规则

一、pytest框架的默认规则 1、模块名默认必须以test开头或者以test结尾 2、测试类必须以Test开头&#xff0c;并且不能有__init__方法 3、测试方法默认必须以test开头 当然以后的一些默认规则除测试类不能使用__init__方法外其余的都是可配置的&#xff0c;当然一般情况下我们…

【算法思想】排序

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kuan 的首页,持续学…

【二叉树魔法:链式结构与递归的纠缠】

本章重点 二叉树的链式存储二叉树链式结构的实现二叉树的遍历二叉树的节点个数以及高度二叉树的创建和销毁二叉树的优先遍历和广度优先遍历二叉树基础oj练习 1.二叉树的链式存储 二叉树的链式存储结构是指&#xff0c;用链表来表示一棵二叉树&#xff0c;即用链来指示元素的逻辑…

Redis集群架构搭建——主从、哨兵、集群

上一篇文章Ubuntu上通过源码方式安装Redis已经介绍了如何安装redis&#xff0c;在这篇文章中&#xff0c;将会教大家搭建Redis的几种高可用的架构&#xff1a;主从架构、哨兵集群、Cluster集群。 本篇文章使用的redis版本为6.2.13&#xff0c;不同版本的配置可能有略微的区别&a…

如何将内网ip映射到外网?快解析内网穿透

关于内网ip映射到外网的问题&#xff0c;就是网络地址转换&#xff0c;私网借公网。要实现这个&#xff0c;看起来说得不错&#xff0c;实际上是有前提条件的。要实现内网ip映射到外网&#xff0c;首先要有一个固定的公网IP&#xff0c;可以从运营商那里得到。当你得到公网IP后…

比特币上的可验证延迟函数

可验证延迟函数 (VDF) 是一种需要大量 顺序计算 来评估但可以快速验证的函数。我们首次在比特币上实现了它。VDF 作为密码学技术可用于构建大量新应用程序&#xff0c;例如公共随机信标、计算时间戳和数据复制证明。 VDF 场景 链上随机信标 在区块链中很难实现随机性&#xf…

李航老师《统计学习方法》第2章阅读笔记

感知机&#xff08;perceptron&#xff09;时二类分类的线性分类模型&#xff0c;其输入为实例的特征向量&#xff0c;输出为实例的类别&#xff0c;取1和-1二值。感知机对应于输入空间&#xff08;特征空间&#xff09;中将实例划分为正负两类的分离超平面 想象一下在一个平面…

人工智能机器学习-飞桨神经网络与深度学习

飞桨神经网络与深度学习-机器学习 目录 飞桨神经网络与深度学习-机器学习 1.机器学习概述 2.机器学习实践五要素 2.1.数据 2.2.模型 2.3.学习准则 2.4.优化算法 2.5.评估标准 3.实现简单的线性回归模型 3.1.数据集构建 3.2.模型构建 3.3.损失函数 3.4.模型优化 3…

怎么实现一个登录时需要输入验证码的功能

今天给项目换了一个登录页面&#xff0c;而这个登录页面设计了验证码&#xff0c;于是想着把这个验证码功能实现一下吧。 这篇文章就如何实现登录时的验证码的验证功能结合代码进行详细地介绍&#xff0c;以及介绍功能实现的思路。 目录 页面效果 实现思路 前端页面代码 lo…

conda常用指令

常用conda指令 查看当前有哪些环境&#xff0c;有base环境 conda env list 创建环境 # conda create -n 你的环境名 python版本号 # 创建python3.10&#xff0c;名为env虚拟环境 conda create -n env python3.10 激活环境 conda activate env

SpringCloud Alibaba - Sentinel篇

一、Sentinel快速入门 Sentinel官网地址&#xff1a;https://sentinelguard.io/zh-cn/index.html Sentinel项目地址&#xff1a;https://github.com/alibaba/Sentinel Sentinel是阿里巴巴开源的一款微服务流量治理组件&#xff0c;主要以流量为切入点&#xff0c;从流量限流、熔…