Linux学习-HIS系统(1)

news2025/2/27 7:06:21
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 = xuwenpeng3
        email = 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 master

No commits yet

nothing 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 master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        readme.md

nothing 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 master

No commits yet

Changes 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 readme
 1 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 +0800

    add 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.txt
 1 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.txt
 1 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.txt

no 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.txt
 1 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 -v
  feature dc4b5a8 done test.txt
  hotfix  dc4b5a8 done test.txt
* master  dc4b5a8 done test.txt
# 切换分支
[root@programer myproject]# git checkout hotfix
Switched to branch 'hotfix'
[root@programer myproject]# git branch -v
  feature dc4b5a8 done test.txt
* hotfix  dc4b5a8 done test.txt
  master  dc4b5a8 done test.txt
[root@programer myproject]# git checkout feature
Switched to branch 'feature'
[root@programer myproject]# git branch -v
* feature dc4b5a8 done test.txt
  hotfix  dc4b5a8 done test.txt
  master  dc4b5a8 done test.txt
[root@programer myproject]# git branch develop
[root@programer myproject]# git branch -v
  develop dc4b5a8 done test.txt
* feature dc4b5a8 done test.txt
  hotfix  dc4b5a8 done test.txt
  master  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.txt
  hotfix  dc4b5a8 done test.txt
  master  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.txt
 1 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.txt
 1 file changed, 1 insertion(+)
 create mode 100644 xixi.txt
[root@programer myproject]# git branch -v
  feature dc4b5a8 done test.txt
  hotfix  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] hotfix
 1 file changed, 1 insertion(+)
 create mode 100644 a.txt
[root@programer myproject]# git branch -v
  feature dc4b5a8 done test.txt
* hotfix  3be70ac hotfix
  master  416f3d7 Merge branch 'hotfix'
[root@programer myproject]# git checkout master
Switched to branch 'master'
[root@programer myproject]# git branch -v
  feature dc4b5a8 done test.txt
  hotfix  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] master
 1 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.coloradmin.cn/o/1027236.html

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

相关文章

将docker镜像打成tar包

# 打包 docker save -o zookeeper.tar bitnami/zookeeper:3.9.0-debian-11-r11# 解压 docker load -i zookeeper.tar

Jenkins学习笔记2

Jenkins下载安装&#xff1a; 从清华源开源镜像站上下载jenkins的安装包&#xff1a; 安装的是这个版本。 关于软件的版本&#xff0c;尽量使用LTS&#xff0c;长期支持。 首先是安装openjdk&#xff1a; yum install fontconfig java-11-openjdk[rootlocalhost soft]# java …

springcloudalibaba和nacos版本对应关系

文章目录 一、背景二、解决bug历程 一、背景 因为公司项目需要升级springcloud的版本&#xff0c;升级后服务启动时连接不上nacos&#xff08;如下图&#xff09; 二、解决bug历程 历程一 一开始直接百度“Client not connected, current status:STARTING”这个错误&#x…

【基于Thread多线程+随机数(Random)+java版本JDBC手动提交事务+EasyExcel读取excel文件,向数据库生成百万级别模拟数据】

基于Thread多线程随机数&#xff08;Random&#xff09;java版本JDBC手动提交事务EasyExcel读取excel文件&#xff0c;向数据库生成百万级别模拟数据 基于Thread多线程随机数&#xff08;Random&#xff09;java版本JDBC手动提交事务EasyExcel读取excel文件&#xff0c;向数据库…

最佳实践:TiDB 业务写变慢分析处理

作者&#xff1a;李文杰 数据架构师&#xff0c;TUG 广州地区活动组织者 在日常业务使用或运维管理 TiDB 的过程中&#xff0c;每个开发人员或数据库管理员都或多或少遇到过 SQL 变慢的问题。这类问题大部分情况下都具有一定的规律可循&#xff0c;通过经验的积累可以快速的定…

9.20号作业实现钟表

1.widget.h #include <QPainter> //画家 #include <QTimerEvent> #include <QTime> #include<QTimer> //定时器类QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACEclass Widget : public QWidget {Q_OBJECTpublic:Wid…

基于Xml方式Bean的配置-初始化方法和销毁方法

SpringBean的配置详解 Bean的初始化和销毁方法配置 Bean在被实例化后&#xff0c;可以执行指定的初始化方法完成一些初始化的操作&#xff0c;Bean在销毁之前也可以执行指定的销毁方法完成一些操作&#xff0c;初始化方法名称和销毁方法名称通过 <bean id"userService…

Linux 目录结构介绍

对上面的说明: root 目录 &#xff1a; linux 超级权限 root 的主目录 home 目录 &#xff1a; 系统默认的用户主目录&#xff0c;如果添加用户是不指定用户的主目录&#xff0c;默认在/home 下创建与用户同名的文件夹 bin 目录 &#xff1a; 存放系统所需要的重要命令&am…

设计模式:简单工厂、工厂方法、抽象工厂

参考 Java设计模式之创建型&#xff1a;工厂模式详解&#xff08;简单工厂工厂方法抽象工厂&#xff09; - 知乎 工厂方法 以生产手机为例&#xff0c;具体的UML图如下&#xff1a; 这种方法的优点是对于用户来说&#xff0c;不再需要面对具体的生产逻辑&#xff0c;只需要将生…

k8s的安装

我这里使用vmware创建了三台虚拟机&#xff0c;k8s的虚拟机建议最少2核、4G内存&#xff0c;我的电脑配置不高采用的2核、3G的配置&#xff1b; 安装k8s之前需要先安装docker&#xff0c;docker的安装参考&#xff1a;docker的安装及使用_docker的安装和使用_骑士999111的博客-…

光伏电池建模及温度光照的影响曲线MATLAB仿真

微❤关注“电气仔推送”获得资料 模型介绍&#xff1a; 需要MATLAB2018B及以上的版本&#xff01;&#xff01; 首先根据根据环境修正公式搭建光伏电池仿真模型&#xff1a; 温度变化下的IU、PU仿真及曲线&#xff1a; 光照变化下的IU、PU仿真及曲线&#xff1a; 文件说明&a…

SSD上 NVIDIA Jetson Orin NANO系統如何刷

对于AI计算性能高达40TOPS的Jetson Orin Nano开发套件来说&#xff0c;如果缺少性能够好的存储相匹配&#xff0c;会让总体执行效益大打折扣。为此&#xff0c;NVIDIA在Jetson Orin Nano开发套件上配置2个M.2接口&#xff08;如下图&#xff09;&#xff0c;最高能安装2片高速P…

Spring Boot启动源码分析

一&#xff0c;前言 版本&#xff1a;spring-boot-starter-parent版本为2.3.0 Spring Boot项目的启动入口是一个main方法&#xff0c;因此我们从该方法入手即可 二&#xff0c;源码分析 跟踪run方法 /*** SpringApplication的方法* param primarySource 启动类的class* p…

静态顺序表及基本操作具体实现

静态顺序表及几个基本操作 &#x1f391;定义一个顺序表&#x1f391; 初始化——置空顺序表&#x1f391;创建一个顺序表&#x1f391;打印顺序表各结点的值&#x1f38a;&#x1f38a; 顺序表基本操作&#x1f383;头插&#x1f383;尾插&#x1f383;头删&#x1f383;尾删 …

mysql报错:mysql8插入sql关键字“rank”问题

标题 一、背景二、报错展示三、排查四、结论 一、背景 在设计表的需要定义一个排名的字段&#xff0c;于是定义了“rank”字段&#xff0c;使用mybatisplus进行插入的时候&#xff0c;项目报错。 二、报错展示 1、项目插入报错 2、mysql中直接insert报错 三、排查 通过ins…

SpringCloud Gateway--网关服务基本介绍和基本原理

&#x1f600;前言 本篇博文是关于SpringCloud Gateway的基本介绍&#xff0c;希望你能够喜欢 &#x1f3e0;个人主页&#xff1a;晨犀主页 &#x1f9d1;个人简介&#xff1a;大家好&#xff0c;我是晨犀&#xff0c;希望我的文章可以帮助到大家&#xff0c;您的满意是我的动力…

快速解决AndroidStudio代码提示失效问题

在编写代码时&#xff0c;代码不自动提示&#xff0c;发现代码自动提示设置正常&#xff0c;所以查询到问题原因在于节能模式的开启&#xff0c;具体解决方式如下&#xff1a; 关闭节能模式 如上图所示&#xff0c;将Power Save Mode前面的对勾去掉&#xff0c;则完成节能模式…

系统检测到您的账户不符合国家相关法律法规或《支付宝用户服务协议》约定,暂时无法签约当前产品

最新一直在开发支付宝小程序&#xff0c;遇到的各种问题颇多&#xff0c;技术上的问题都好解决&#xff0c;开发平台上的问题&#xff0c;真的是让我心力交瘁&#xff0c;自己分析不出原因&#xff0c;打支付宝客服电话永远得不到解答。 现在把自己有一些收获的问题&#xff0…

rk3568环境配置和推理报错: RKNN_ERR_MALLOC_FAIL

前言 最近在部署算法在板子侧遇到的一些问题汇总一下&#xff1a; 一、版本问题 经过测试现在将自己环境配置如下&#xff1a; 本地linux安装rknn-toolkit2-1.5.0 本地Linux使用的miniconda新建的一个python虚拟环境&#xff08;自行网上查找相关方法&#xff09; 安装好自…

Docker Desktop 界面功能介绍,添加国内镜像源

目录 镜像源修改设置 其他偏好设置 镜像源修改设置 默认情况下&#xff0c;Docker Desktop会从Docker Hub下载镜像&#xff0c;但在国内由于网络的原因&#xff0c;下载速度可能较慢&#xff0c;配置国内镜像源可以提速镜像下载。在Docker Desktop中配置镜像源非常简单&…