前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布

git

作者头像
yuezhimi
发布2020-09-30 11:39:00
3500
发布2020-09-30 11:39:00
举报
文章被收录于专栏:yuezhimi

GIT是一个分布式版本管理系统,速度快,适合大规模,跨地区多人协同开。SVN是一个集中式版本管理系统。

GIT分布式版本管理系统

Gitlab git私库解决方案

Github git公有库解决方案

git安装

Centos:

yum install -y git

Ubuntu:

apt-get install git

Windows安装git bash

linux编译安装

代码语言:javascript
复制
#安装依赖包
[root@localhost ~]# yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

[root@localhost ~]# unzip v2.7.4.zip
[root@localhost ~]# cd git-2.7.4/
[root@localhost git-2.7.4]# make prefix=/usr/local/git all
[root@localhost git-2.7.4]# make prefix=/usr/local/git install
[root@localhost git-2.7.4]# rm -f /usr/bin/git
[root@localhost git-2.7.4]# ln -s /usr/local/git/bin/git /usr/bin/git
[root@localhost git-2.7.4]# git --version
git version 2.7.4

初始化仓库

代码语言:javascript
复制
[root@localhost ~]# mkdir test && cd test
[root@localhost test]# git init
[root@localhost test]# git config --global user.name "test"
[root@localhost test]# git config --global user.email test@qq.com
[root@localhost test]# git config --list
user.name=test
user.email=test@qq.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
代码语言:javascript
复制
四个区域:
远程仓库<-->本地仓库<-->暂存区域<-->工作目录
代码语言:javascript
复制
四种状态
Untracked、Unmodified、Modified、Staged
Untracked(工作目录)-->git add -->Staged(暂存区)-->git commit版本-->Unmodified(本地仓库)-->Edit file-->Modified-->Stage the file-->Staged
代码语言:javascript
复制
常用命令
代码语言:javascript
复制
git add 加入暂存
git status 查看状态
git status -s 状态概览
git diff 尚未暂存的文件
git diff --staged 暂存区文件
git commit 提交更新
git reset 回滚
git rm 从版本库中移除
git rm --cached README 从暂存区中移除
git mv 相当于mv git rm git add 三个命令

分支命令

代码语言:javascript
复制
git branch例出分支
git branch -v
git branch --merged查看哪些分支被合并
git branch --no-merged查看哪些分支未被合并
git branch -d testling删除分支
git checkout切换分支
git merged融合分支
代码语言:javascript
复制
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-04-10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档