git使用

发布于 2023-11-26  760 次阅读


git版本控制器

常见版本控制器

集中式

只有一个中央数据库,访问速度满,需要联网,而且如果中央数据库崩掉,所有用户都无法访问或修改备份操作了

分布式

git是一个典型的分布式版本控制器,访问速度快,每个人的电脑都是一个完整的版本库

安装使用

yum install -y git
#配置本地信息
[root@server1 my_git]# git config --global user.name "wanli"
[root@server1 my_git]# git config --global user.email "wanli320@qq.com"
[root@server1 my_git]# git config --global color.ui true
[root@server1 my_git]# git config --list
user.name=eagle
user.email=eagle@qq.com
color.ui=true


创建并初始化仓库

git概念介绍


工作区存放文件,通过git add 加入到暂存区,暂存区在.git这个隐藏文件里面,然后git commit . -m "first commit"进行提交到本地仓库,然后通过git push推到远程git仓库
常见的git仓库有github 但是现在国内被ban了 访问比较不方便,国内有个gitee算是github的一个平替版 码云

.git文件内容

[root@localhost my_git]# tree -a
.
└── .git
    ├── branches
    ├── config
    ├── description
    ├── HEAD
    ├── hooks
    │   ├── applypatch-msg.sample
    │   ├── commit-msg.sample
    │   ├── post-update.sample
    │   ├── pre-applypatch.sample
    │   ├── pre-commit.sample
    │   ├── prepare-commit-msg.sample
    │   ├── pre-push.sample
    │   ├── pre-rebase.sample
    │   └── update.sample
    ├── info
    │   └── exclude
    ├── objects
    │   ├── info
    │   └── pack
    └── refs
        ├── heads
        └── tags

  • alipay_img
  • wechat_img
一朝风月,万古长空
最后更新于 2023-12-19