GIT工具流程理解及使用说明

Git:分布式版本控制工具
每个端原始的代码仓库完整地镜像下来

图(1):说明本地的代码与远程仓库(即GIT服务器上)代码是完整的镜像

本地代码与远程仓库代码更新&提交示意图
图(2):主要说明以下4点:
(1)git fetch:是将GIT服务器(远程仓库)上代码更新到本地的远程分支上;
(2)GIT PULL:是将GIT服务器(远程仓库)上代码更新到本地的远程分支上同时将更新的代码合入到本地当前分支上;
(3) GIT COMMIT:是将本地目录下的改动内容提交到本地仓库的分支上;
(4)GIT PUSH:是将本地仓库分支上的改动提交到远程仓库中

以下添加远程仓库及本地仓库操作实例:
1、在GIT服务器上创建仓库:(在10.192.3.2服务器上操作,工作目录: /home/git)
创建项目: mkdir hspvirtual
chown -R apache:apache hspvirtual
生成仓库:cd hspvirtual
git init –bare

2、在本地进行远程仓库Clone(即代码拉取,生成本地仓库): https://ahyu@10.192.3.2/git/hspvirtual
“C:\Program Files\Git\bin\git.exe” clone -v –recurse-submodules –progress “https://ahyu@10.192.3.2/git/hspvirtual” “C:/Users/ahyu/work/git/hspvirtual”
Cloning into ‘C:/Users/ahyu/work/git/hspvirtual’…
warning: You appear to have cloned an empty repository.
Checking connectivity… done.
Done
注:对应GIT工具是的Clone操作

3、拉取远程仓库代码(即GIT FETCH)
“C:\Program Files\Git\bin\git.exe” fetch –progress “–all”
Fetching origin
Done

  1. push本地仓库代码至远程仓库:(即GIT PUSH)
    “C:\Program Files\Git\bin\git.exe” push –recurse-submodules=check –progress “origin” refs/heads/master:refs/heads/master
    Counting objects: 21, done.
    Delta compression using up to 4 threads.
    Total 21 (delta 0), reused 0 (delta 0)
    To https://ahyu@10.192.3.2/git/hspvirtual
    • [new branch] master -> master
      Done
      注:使用工具时,提交功能:GIT COMMIT, 推送功能:GIT PUSH
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值