• git工作中新建创建,合并分支


    第一步:用git工具把相关代码推到master,然后新建分支,推到相关分支上

    进入所在的项目目录中
    git config --global user.name "liuxueqin"
    git config --global user.email "liuxueqin@zhiyunyi.net"
    it init
    git remote add origin http://gitlab.zhiyunyi.net/lawsuit/lawsuitweb.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    这所有的步骤就是把本地代码推到git上

    git 开分支
    如果本地没有代码那么第一步是克隆(https)
    git clone http://gitlab.zhiyunyi.net/lawsuit/lawsuitweb.git
    git checkout latest 这一步是必须的latest是固定名字
    git checkout -b test 创建分支切换到分支上
    git branch 查看分支
    git add .
    git commit -m "Initial commit"
    git push -u origin test
    git branch -d test 删除分支

    第二步:合并分支

    1.创建合并

    2.把自己的分支合并到latest分支上

    3.合并

    5.点击合并代码并且删除源分支,如果是自己创建的分支到latest分支上这时需要删除源分支,如果latest到master,这时候千万不要删除分支

    方法二:所有的开分支,合并代码全部用命令行

    Git操作步骤

    进入所在的项目目录中

    git config --global user.name "liuxueqin"
    git config --global user.email "liuxueqin@zhiyunyi.net"
    it init
    git remote add origin http://gitlab.zhiyunyi.net/lawsuit/lawsuitweb.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master

    这所有的步骤就是把本地代码推到git上

    git 开分支
    如果本地没有代码那么第一步是克隆(https)

    git clone http://gitlab.zhiyunyi.net/lawsuit/lawsuitweb.git

    第一步:保证本地代码是最新的仓库代码

    git checkout master
    git pull
    git checkout latest
    git pull

    第二步在latest上新建分支

    git checkout -b test 
    git add .
    git commit -m "Initial commit"

    第三步新建的分支合并到latest分支上

    git checkout latest
    git merge test

    在合并代码的时候出现一个弹出层
    1按i,然后填写修改信息
    2 按键盘左上角"Esc",输入":wq",注意是冒号+wq,按回车键即可
    第四步把本地latest分支推送到远程仓库中,这样是保证latest远程仓库和本地代码是一致的

    git push -u origin latest

    第五步latest分支合并到master主干上

    git checkout master
    git merge latest

    第六步本地master代码推送到远程仓库master,并且删除分支

    git push -u origin master
    git branch -d test 

    第七步完结,开不开心,高不高兴,哈哈

  • 相关阅读:
    The connection to the server localhost:8080 was refused
    Error: client: etcd cluster is unavailable or misconfigured; error #0: dial tcp 127.0.0.1:4001: getsockopt: connection refused
    docker-machine on azure
    Spine学习二 -播放Spine动画
    第三人称角色控制器解析
    3D人物移动控制实现方案
    Transform与Vector3 的API
    Animator.SetFloat(string name,float value,float dampTime,float deltaTime)详解
    Unity坑之 加了Rigidbody后主角反而朝天上飞?
    使用代码给Unity中的动画片段绑定回调函数
  • 原文地址:https://www.cnblogs.com/binmengxue/p/12971418.html
Copyright © 2020-2023  润新知