zoukankan      html  css  js  c++  java
  • git使用技巧

    项目用的gitlab,用命令行:
    1,先检出项目到一个文件夹
    git clone


    2,你检出的项目默认是master,所以现在要查看远程全部分支
    git branch -a

    例如:

    * master
    remotes/origin/HEAD -> origin/master
    remotes/origin/v1.2
    remotes/origin/master
    remotes/origin/v1.1
    remotes/origin/v1.0

    3,切换分支
    比如同时有三个人开发,1.2最早是基于1.0,但是由于项目未发布,1.0,1.1,1.2全部都在同时开发,现在想把1.0已经增加的功能先合并到1.2;

    此时的步骤:check 1.2和1.0
    git checkout v1.0
    git checkout v1.2

    然后再v1.2的分支基础上执行merge
    git merge v1.0

    如果没有报错,那就直接提交代码git push origin v1.2
    如果报错,基本是冲突了(比如):
    CONFLICT (content): Merge conflict in app/src/main/AndroidManifest.xml
    Auto-merging app/build.gradle
    CONFLICT (content): Merge conflict in app/build.gradle
    Automatic merge failed; fix conflicts and then commit the result.

    你需要去到提示的文件里把git自动标注的版本冲突注释掉,看你具体需要的功能进行删减

    然后把冲突的文件git add,和commit
    ,比如你有2个冲突文件,多文件add的时候直接空格隔开

    git add app/src/main/AndroidManifest.xml app/build.gradle

    最后再commit

    git commit -m "解决2个分支之间的冲突"

    4,提交代码
    git push origin v1.2

  • 相关阅读:
    C/C++操作MySQL数据库——增、删、改、查
    Mysql常用命令行大全——转载
    .NET Framework、C#、ASP.NET之间的关系
    委托和事件
    ASP.NET 页生命周期概述
    在SqlServer下增加MySql的链接服务器
    Head First 设计模式----DecoratorPattern
    jquery easyui----tree
    Head First 设计模式----ObserverPattern
    Jquery easyui----combotree
  • 原文地址:https://www.cnblogs.com/lkzp123456/p/9468044.html
Copyright © 2011-2022 走看看