zoukankan      html  css  js  c++  java
  • git使用总结

    在项目开发过程中,git具有项目版本管理的功能,帮助开发人员进行项目的合并,使用方法也是非常简单 ,github上上传项目时就给出了详细的项目上传步骤,如图所示:

    一、git的初始化和上传

    ①、git init

    生成本地.git文件,初始化。

    ②、git add Readme.md

    添加上传文件

    ③、git commit -m  'v1.0.1'

    给该版本一个版本号或者修改了什么内容,一个备注信息。

    ④、git remote add origin https://github.com/php-zy/test.git

    添加默认远程仓库地址,顾名思义,上传到你git线上的地址去 。

    ⑤、git pull origin master

    从默认分支拉取代码

    ⑥、git push -u origin master

    将此次操作上传到默认的分支下

    ——首次操作,调过⑤拉取代码步骤。

    二、git新建分支及上传代码

    查看分支:git branch

    新建分支:git branch newMaster

    选择分支:git checkout newMaster

    选择分支后,(步骤与上面相同,但是需要将分支的名称改为你选择的分支)

    ②、git add Readme.md

    添加上传文件,将文件提交到暂存区。

    ③、git commit -m  'v1.0.1'

    给该版本一个版本号或者修改了什么内容,一个备注信息。

    ④、git remote add origin https://github.com/php-zy/test.git

    添加默认远程仓库地址,顾名思义,上传到你git线上的地址去 。

    ⑤、git pull origin newMaster

    从新的分支拉取代码

    ⑥、git push -u origin newMaster

    将此次操作上传到选择的新的分支下。

    三、分支的合并和删除

    假设你已经修正了某分支上的 问题,并且打算将你的工作合并入 master 分支。 为此,你需要合并 iss53 分支到 master 分支, 你只需要检出到你想合并入的分支,然后运行 git merge 命令:

    git checkout master
    Switched to branch 'master'
    git merge iss53 Merge made by the 'recursive' strategy. index.html | 1 + 1 file changed, 1 insertion(+)


    分支的删除:
    git branch -d hotfix
    Deleted branch hotfix (3a0874c).
     
  • 相关阅读:
    fetch的使用--当无法判断后台返回数据为什么类型时如何操作
    单页面与多页面间的区别及优缺点
    关于倒计时在关屏后不准确的问题
    前端分页仿百度分页效果
    pc端的弹性布局适配方案
    前端性能优化方向
    居民身份证号码组成规则
    axios简单介绍
    es6 promise 简单总结
    js原型链和原型链的继承
  • 原文地址:https://www.cnblogs.com/blog-zy/p/10838309.html
Copyright © 2011-2022 走看看