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

news2024/10/6 22:33:11
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/1034536.html

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

相关文章

山西电力市场日前价格预测【2023-09-24】

日前价格预测 预测说明&#xff1a; 如上图所示&#xff0c;预测明日&#xff08;2023-09-24&#xff09;山西电力市场全天平均日前电价为496.09元/MWh。其中&#xff0c;最高日前电价为705.54元/MWh&#xff0c;预计出现在14: 30。最低日前电价为333.70元/MWh&#xff0c;预计…

竞赛选题 基于深度学习的视频多目标跟踪实现

文章目录 1 前言2 先上成果3 多目标跟踪的两种方法3.1 方法13.2 方法2 4 Tracking By Detecting的跟踪过程4.1 存在的问题4.2 基于轨迹预测的跟踪方式 5 训练代码6 最后 1 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 基于深度学习的视频多目标跟踪实现 …

C语言学习系列—>一篇带你了解结构体

文章目录 前言结构体类型概述声明特殊声明结构体的自引用结构体变量的创建和初始化结构成员访问操作符结构体内存对齐内存对齐的原因修改默认对齐方式结构体传参 前言 结构体是C语言中自定义类型之一&#xff0c;当内置类型不能满足的时候&#xff0c;我们就可以使用自定义类型…

怎样快速提取视频中的背景音乐和人声?

人声分离的需求在现在还是比较多的&#xff0c;例如做影视混剪、做配音等&#xff0c;都需要将视频或音频中的人声分离开&#xff0c;今天就来教大家如何快速提取视频中的背景音乐和人声&#xff01; 第一步&#xff1a;打开“音分轨”人声分离APP&#xff0c;点击主页“短视频…

自己写过比较蠢的代码:从失败中学习的经验

文章目录 引言1. 代码没有注释2. 长函数和复杂逻辑3. 不恰当的变量名4. 重复的代码5. 不适当的异常处理6. 硬编码的敏感信息7. 没有单元测试结论 &#x1f389; 自己写过比较蠢的代码&#xff1a;从失败中学习的经验 ☆* o(≧▽≦)o *☆嗨~我是IT陈寒&#x1f379;✨博客主页&a…

以太坊智能合约的历史里程碑: 从DAO到数据隐私的技术演进

文章目录 系列文章目录前言一、时间线 项目介绍总结 前言 在短短的几年内&#xff0c;以太坊不仅成为了去中心化应用和智能合约的主导平台&#xff0c;而且也见证了区块链技术和应用的多次重大革命。本文详细回顾了自2016年至今&#xff0c;以太坊生态所经历的几个关键时刻与技…

天津乾瑞晟达积极加大研发投入 满足行业发展需求

天津乾瑞晟达新能源科技有限公司多年以来,坚持新能源汽车零部件的研发、生产以及销售等综合业务,成为了一家有实力的综合制造企业。为了满足行业发展需求,该公司积极加大研发投入,持续推动科技创新。 根据最新的财务报告显示,天津乾瑞晟达公司为了研发新的项目,确保可以使项目…

Spring面试题15:Spring支持几种bean的作用域?singleton、prototype、request的区别是什么?

该文章专注于面试,面试只要回答关键点即可,不需要对框架有非常深入的回答,如果你想应付面试,是足够了,抓住关键点 面试官:Spring支持几种bean的作用域? Spring支持以下几种Bean的作用域: Singleton(单例):这是Spring默认的作用域。使用@Scope(“singleton”)注解或…

精品Python宠物领养网站系统失物招领

《[含文档PPT源码等]精品基于Python实现的宠物网系统》该项目含有源码、文档、PPT、配套开发软件、软件安装教程、项目发布教程等 软件开发环境及开发工具&#xff1a; 开发语言&#xff1a;python 使用框架&#xff1a;Django 前端技术&#xff1a;JavaScript、VUE.js&…

鲜花店经营配送小程序商城的作用是什么?

鲜花在人们日常生活中的应用度非常高&#xff0c;在同城场景中也有大量从业者&#xff0c;对商家们来说&#xff0c;其主要生意来源于本地&#xff0c;当然也有批发或同时经营玩具类的商家会有外地配送属性。 所谓客户在哪里&#xff0c;商家就应在哪里&#xff0c;如今互联网…

随笔-服务器运维常用的命令

查询服务器的目录下&#xff0c;所有的文件大小 // 查看当前目录下&#xff0c;深度为3的所有目录内容大小 du -h –max-depth3 *// 查看目录下文件夹大小写&#xff0c;并按照大小排序 du -sh * | sort -rh查看当前目录下文件的大小 // 查看文件大小 ll -h3. 清空文件内容 …

【从0学习Solidity】22. Call函数详解

【从0学习Solidity】22. Call函数详解 博主简介&#xff1a;不写代码没饭吃&#xff0c;一名全栈领域的创作者&#xff0c;专注于研究互联网产品的解决方案和技术。熟悉云原生、微服务架构&#xff0c;分享一些项目实战经验以及前沿技术的见解。关注我们的主页&#xff0c;探索…

kux转mp4,实测有效,有图有真相

kux转mp4 kux视频格式真坑爹&#xff0c;我在MAC下载优酷&#xff0c;居然无法播放这种格式&#xff0c;这就是优酷专属的下载格式啊&#xff0c;真不是一般烦人。故而切换到window系统&#xff0c;实验了一下午&#xff0c;找了所有单独的第三方软件&#xff0c;下载的时候一个…

倒置字符串(牛客)

一、题目 二、代码 #include <iostream> #include<string> using namespace std;int main() {string s;getline(cin, s);string s2;int i s.length() - 1;int prev i;int next 0;while (i > 0 && prev > 0) { //从字符串的最后往前遍历if (s[pre…

排序子序列(牛客)

目录 一、题目 二、代码 &#xff08;一&#xff09;时间复杂度过高&#xff08;通过70%&#xff09; &#xff08;二&#xff09;改进 一、题目 二、代码 &#xff08;一&#xff09;时间复杂度过高&#xff08;通过70%&#xff09; #include <iostream> #includ…

C语言内功修炼--指针详讲(进阶)

前言&#xff1a; 通过之前的指针初阶讲解&#xff0c;相信大家已经大概明白了指针的概念以及基本用法&#xff0c;这里我再来整理一下&#xff1a; 1.指针就是一个变量&#xff0c;用来存放地址&#xff0c;地址唯一标识着内存的一块空间。 2.指针具有类型&#xff0c;指针…

单元测试的重要性

前言 在日常生活中&#xff0c;单元测试无论是对软件测试人员还是开发人员&#xff0c;都扮演着重要的角色。这主要是因为&#xff0c;单元测试在开发阶段&#xff0c;可以确保每个组件和程序都能够正常的运行。 很多开发人员都讨厌编写单元测试&#xff0c;但是它可以在开发…

变量使用、

六&#xff1a;变量使用 1.语法格式 变量调用语法&#xff1a; {{ var_name }} 案例&#xff1a; 通过命令行传递变量&#xff1a;&#xff08;通过--extra-vars或-e选项来传递keyvalue变量&#xff09; vim var.yaml 传递字典(同时传递多个变量) vim var-1.yaml 案例二…

竞赛 基于深度学习的行人重识别(person reid)

文章目录 0 前言1 技术背景2 技术介绍3 重识别技术实现3.1 数据集3.2 Person REID3.2.1 算法原理3.2.2 算法流程图 4 实现效果5 部分代码6 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 基于深度学习的行人重识别 该项目较为新颖&#xff0c;适合…

居家养老一键通的功能

居家养老一键通的功能 居家养老一键通是指为老年人提供全方位的居家养老服务的平台或系统。它通过整合各种资源和服务&#xff0c;为老年人提供便捷、安全、舒适的居家养老环境&#xff0c;帮助他们解决生活中的各种难题。 居家养老一键通的功能通常包括以下几个方面&#xff…