0
点赞
收藏
分享

微信扫一扫

大数据技术之 Apache Doris(一)

金牛豆豆 1天前 阅读 1

一、环境说明

[root@git ~]# getenforce
Disabled
[root@git ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

3月 23 09:35:07 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
3月 23 09:35:08 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
3月 23 09:35:08 localhost.localdomain firewalld[1466]: WARNING: AllowZoneDrifting is enabled. This is co...ow.
3月 23 09:35:16 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
3月 23 09:35:16 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@git ~]# uname -a
Linux git 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@git ~]# rpm -qa centos-release
centos-release-7-9.2009.0.el7.centos.x86_64

二、git的两种安装方式

1、yum安装git

centos自带git

[root@git ~]# rpm -qa git
git-1.8.3.1-25.el7_9.x86_64

 安装方法

[root@git ~]# yum install git -y
2、编译安装

编译安装可以安装较新版本的git

Git下载地址: Releases · git/git · GitHub

 

# 安装依赖关系
[root@git ~]# yum install curl-devel expat-devel gettext-devel  openssl-devel zlib-devel autoconf gcc perl-ExtUtils-MakeMaker
# 编译安装 
[root@git ~]# tar -zxf git-2.0.0.tar.gz
[root@git ~]# cd git-2.0.0
[root@git ~]# ./configure --prefix=/usr/local/git # 没有文件可以略过
[root@git ~]# make  
[root@git ~]# make install 

三、初次运行 Git 前的配置

 配置git

 四、获取 Git 仓库(初始化仓库)

1、创建裸库
[root@git ~]# useradd git
[root@git ~]# passwd git
更改用户 git 的密码 。
新的 密码:
无效的密码: 密码是一个回文
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@git ~]# mkdir /git-root/
[root@git ~]# cd /git-root/
[root@git git-root]# git init --bare shell.git
初始化空的 Git 版本库于 /git-root/shell.git/
[root@git git-root]# chown -R git:git shell.git
[root@git git-root]# ll
总用量 0
drwxr-xr-x 7 git git 119 3月  23 10:32 shell.git
2、创建本地库
[root@git ~]# cd /opt/
[root@git opt]# ssh-keygen
[root@git opt]# ssh-copy-id git@10.12.153.234
[root@git opt]# git clone git@10.12.153.234:/git-root/shell.git
正克隆到 'shell'...
warning: 您似乎克隆了一个空版本库。
[root@git opt]# ls
shell
[root@git opt]# cd  shell/
[root@git shell]# ll
总用量 0

五、git的使用 

1、添加新文件
[root@git shell]# pwd
/opt/shell
[root@git shell]# vim test1.sh
[root@git shell]# git add test1.sh
[root@git shell]# git commit -m 'first commit'
[master(根提交) 2b45ee9] first commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test1.sh
[root@git shell]# git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 206 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@10.12.153.234:/git-root/shell.git
 * [new branch]      master -> master

 常用操作示意图

2、删除git内的文件 

命令说明:

• 没有添加到暂存区的数据直接rm删除即可。

• 已经添加到暂存区数据:

git rm --cached database

#→将文件从git暂存区域的追踪列表移除(并不会删除当前工作目录内的数据文件)

git rm -f database

#→将文件数据从git暂存区和工作目录一起删除

3、查看历史记录
[root@git shell]# git log
commit d900a5e7559cda2372b18079c7e65f89c23a490f
Author: xiaowang <1196431288@qq.com>
Date:   Sat Mar 23 10:53:31 2024 +0800

    second commit

commit 2b45ee9416fa183675f413d1911f75a56efe2e7d
Author: xiaowang <1196431288@qq.com>
Date:   Sat Mar 23 10:49:38 2024 +0800

    first commit
4、还原历史数据

git reset --hard hash值

git reset --hard HEAD^ #→还原历史提交版本上一次

git reset --hard 3de15d4 #→找到历史还原点的SHA-1值后,就可以还原(值不写全,系统

会自动匹配)

5、还原未来数据
6、标签使用 
7、对比数据

git diff可以对比当前文件与仓库已保存文件的区别,知道了对README作了什么修改

后,再把它提交到仓库就放⼼多了。

六、分支结构 

在实际的项目开发中,尽量保证master分支稳定,仅用于发布新版本,平时不要随便直接修改里面的数据文件。

那在哪干活呢?干活都在dev分支上。每个人从dev分支创建自己个人分支,开发完合并到dev分支,最后dev分支合并到master分支。所以团队的合作分支看起来会像下图那样。

1、切换分支/创建分支 
 2、在newttt分支修改
[root@git shell]# git branch
  master
  newrain
* newttt
[root@git shell]# cat README
cat: README: 没有那个文件或目录
[root@git shell]# echo '1901' >> README 
[root@git shell]#  git add .
[root@git shell]#  git commit -m '1901'
[newttt 938ad56] 1901
 2 files changed, 1 insertion(+)
 create mode 100644 README
 create mode 100644 test3.sh
 3、回到master分支
[root@git shell]# git checkout master
切换到分支 'master'
[root@git shell]# cat README
cat: README: 没有那个文件或目录
[root@git shell]# git log  -1
commit d900a5e7559cda2372b18079c7e65f89c23a490f
Author: xiaowang <1196431288@qq.com>
Date:   Sat Mar 23 10:53:31 2024 +0800

    second commit
 4、合并代码
[root@git shell]# git merge newttt
更新 d900a5e..938ad56
Fast-forward
 README   | 1 +
 test3.sh | 0
 2 files changed, 1 insertion(+)
 create mode 100644 README
 create mode 100644 test3.sh
[root@git shell]# cat README 
1901
[root@git shell]# git log -1
commit 938ad56feacac2e99487b7cb7ae561ae3ce49225
Author: xiaowang <1196431288@qq.com>
Date:   Sat Mar 23 12:09:12 2024 +0800

    1901

 

举报

相关推荐

0 条评论