zoukankan      html  css  js  c++  java
  • git

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

    GIT分布式版本管理系统

    Gitlab git私库解决方案

    Github git公有库解决方案

    git安装

    Centos:

    yum install -y git

    Ubuntu:

    apt-get install git

    Windows安装git bash

    linux编译安装

    #安装依赖包
    [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

    初始化仓库

    [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
    四个区域:
    远程仓库<-->本地仓库<-->暂存区域<-->工作目录
    四种状态
    Untracked、Unmodified、Modified、Staged
    Untracked(工作目录)-->git add -->Staged(暂存区)-->git commit版本-->Unmodified(本地仓库)-->Edit file-->Modified-->Stage the file-->Staged
    常用命令
    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 三个命令

    分支命令

    git branch例出分支
    git branch -v
    git branch --merged查看哪些分支被合并
    git branch --no-merged查看哪些分支未被合并
    git branch -d testling删除分支
    git checkout切换分支
    git merged融合分支
    
    
  • 相关阅读:
    Java中的CopyOnWrite
    Collection和Collections的区别
    java中值类型与引用类型的关系
    Xml的用途
    js弹框的3种方法
    文件夹重定向失败解决方案
    网络管理人员经常遇到的十个问题(转载)
    QTP之下拉列表单选框…
    Windows脚本宿主对象模型
    QTP报错“缺少对象WScript”
  • 原文地址:https://www.cnblogs.com/yuezhimi/p/10684790.html
Copyright © 2011-2022 走看看