git

git

安装
配置git使用用户
配置git使用邮箱
配置语法高亮
查看全局配置

yum insatll git -y
git config --global user.name "test"
git config --global user.email "test@mail.com"
git config --global color.ui true
git config --list

也可以在家目录查看修改

[root@jenkins /]# cd
[root@jenkins ~]# cat .gitconfig
[user]
        name = test
        email = test@mail.com
[color]
        ui = true


创建目录
进入目录
初始化
查看工作区状态

mkdir test
cd test
git init
git status

创建文件
添加指定文件到暂存区
撤出暂存区
修改文件
添加全部到暂存区
将工作区提交到本地仓库,引号里面是对该次提交的描述

touch index.html
git add index.html
git rm reset index.html
echo "hello world" > index.html
git add ./*
git commit  -m 'first commit'  

创建新分支
切换分支
查看分支
修改文件
添加全部到暂存区
将工作区提交到本地仓库,引号里面是对该次提交的描述

git branch test
git checkout test
git branch
echo "世界,你好!" > index.html
git add ./*
git commit  -m 'test commit' 

切换到主分支
查看所有未合并的分支
合并代码
历史版本查看
删除分支(如果分支有未合并的工作将不能删除)

git checkout master
git branch --no-merged
git merge test
git log
git branch -d test

修改文件
对比数据
添加全部到暂存区
将工作区提交到本地仓库,引号里面是对该次提交的描述

echo "Hello World!" > index.hdml
git diff index.html
git add ./*
git commit  -m 'second commit' 

历史版本查看
回滚到指定版本
查看未来历史更新点

git log
git reset --hard 3c22e04
git reflog

给某个版本打标签
查看标签
查看test_v1.0 版本的详细信息
回滚到标签版本
删除标签
创建有描述的标签

git tag test_v1.0 1081904
git tag
git show test_v1.0 
git reset --hard test_v1.0
git tag -d test_v1.0
git tag test_v1.0 -m "test only commit" 1081904

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值