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