• git branch 分支操作


    git 基本操作

    远程仓库克隆到本地

    git clone ssh://git@xxx

    本地修改提交到远程仓库

    git add newfile<details>
    git commit -m "提交newfile,ps: 这引号内容是备注,必须要有内容"
    git push

    从远程仓库同步文件到本地

    git pull

    git分支操作

    分支简介

    新建分支并同步到远程仓库

    本地新建分支

    git branch newBranch //创建分支newBranch

    查看分支信息

    git log --oneline --decorate --graph --all

    切换分支

    git checkout newBranch //切换到新分支

    将新分支提交到远程仓库

    git push origin newBranch //这样才能在远程看到该分支

    将本地分支和远程分支关联

    git branch --set-upstream-to=origin/newBranch newBranch //这样才能正常的pull和push




    合并分支

    申请合并

    在gitlab上进行操作
    pic
    pic2

    审核端

    线上解决冲突,务必注意:文件名不能带中文,否则解决冲突显示不出内容
    pic4
    pic5




    本地git bash合并

    pic3
    git fetch origin //保持与远程同步
    git checkout main //切换到main分支
    git merge --no-ff newBranch //普通合并分区
    git status
    查看合并状态,根据status提示将有冲突的文件改写并保存
    git add xxx //暂存修改冲突的文件,告诉git你已经解决冲突
    git commit //提交合并
    此时会出现合并内容提示的窗口,确认无误使用:wq退出即可
    git push //推送到远程
    完成合并

  • 相关阅读:
    设计模式六大原则
    .net Stream篇(七)
    .net Stream篇(六)
    .net Stream篇(五)
    .net Stream篇(四)
    Leetcode 18
    Leetcode 16
    Leetcode 15
    Leetcode 12
    Leetcode 9
  • 原文地址:https://www.cnblogs.com/CliY/p/16167687.html
Copyright © 2020-2023  润新知