GIT分布式版本控制系统

代码协同管理工具

SVN  GIT

什么是git

  • git是一个开源的分布式版本控制系统,用于高效敏捷的管理大小项目代码。

git特点

  • git 可以管理各种文件,特别是代码项目,多使用在*nix系统中
  • 是分布式管理,不同于集中管理,这是git和svn的核心区
  • 更好的分支
  • 拥有全球唯一的版本号
  • 代码安全性更加有保证
  • 开源方便,数据传输速度更快,可以无网络操作

集中式和分布式

  • 集中式:代码集中管理,需要上传到中央处理器,每次更新都从中央服务器下载
  • 分布式:每个节点都保存完整的代码,没有中央处理器,节点之间相互推送下载完成戴拿共享,(git)

git的安装

  • linux下
    sudo apt-get install git
  • windows:
    msysgit.github.io

git的配置

  • git配置工具:git config

配置级别

  1. 系统中所有用户都使用
    /etc/gitconfig 文件

    配置姓名
    git config --system user.name [your name]
    git config --system user.email [yourmail]
    arena@tedu:~/git$ git config --system user.name kang
    tarena@tedu:~/git$ sudo git config --system user.email [email protected]
    tarena@tedu:~/git$ ls
    tarena@tedu:~/git$ cd /etc
    tarena@tedu:/etc$ ls
    
    tarena@tedu:/etc$ cat gitconfig
    [user]
    	name = kang
    	email = [email protected]
    
    
    
  2. 作用于当前用户
    ~/.gitconfig 文件
    git config --global user.name [yourname]
    e.g.
    sudo git config --global user.name Levi
    tarena@tedu:~$ cat .gitconfig
    [user]
    	name = Levi
    

     

  3. 作用于当前项目仓库
    .git/config

    配置编译器
    git config core.editor [youreditor]
    e.g.
    git config core.editor vim
    arena@tedu:~/git$ git init
    初始化空的 Git 仓库于 /home/tarena/git/.git/
    tarena@tedu:~/git$ ls
    tarena@tedu:~/git$ ll
    总用量 12
    drwxrwxr-x  3 tarena tarena 4096 8月  30 19:57 ./
    drwxr-xr-x 38 tarena tarena 4096 8月  30 19:47 ../
    drwxrwxr-x  7 tarena tarena 4096 8月  30 19:57 .git/
    tarena@tedu:~/git$ cd .git/
    tarena@tedu:~/git/.git$ ls
    branches  config  description  HEAD  hooks  info  objects  refs
    tarena@tedu:~/git/.git$ cat config
    [core]
    	repositoryformatversion = 0
    	filemode = true
    	bare = false
    	logallrefupdates = true
    tarena@tedu:~/git/.git$ cd 
    tarena@tedu:~$ cd git
    tarena@tedu:~/git$ git config core.editor vim
    tarena@tedu:~/git$ cat .git/config
    [core]
    	repositoryformatversion =
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值