zoukankan      html  css  js  c++  java
  • git操作

    git init

    git clone /path/to/repository

    your local repository consists of three "trees" maintained by git. the first one is your Working Directory which holds the actual files.

    the second one is the Index which acts as a staging area and finally the HEAD which points to the last commit you've made.

    git add <filename>

    git commit -m "Commit message"

      Now the file is committed to the HEAD, but not in your remote repository yet.

    git push origin master

      send those changes to your remote repository

    Branches are used to develop features isolated from each other. The master branch is the "default" branch when you create a repository.

    Use other branches for development and merge them back to the master branch upon completion.

    git fetch

    git branch

    git checkout -b feature_x

    git pull

      update your local repository to the newest commit

    git merge branch2

      merge another branch into your active branch

    ===========================================================

    merge时,切到你的开发分支,然后在merge别的分支。

    Step 1. 执行fetch操作, 并将合并的目标分支检出到本地

    git fetch origin

    git checkout -b releases/branch origin/releases/branch111

    Step 2. 使用版本号进行合并, 将出现的冲突一一解决, 并进行commit

    git merge --no-ff xxxxxxx

     

    --no-ff指的是强行关闭fast-forward方式。

    fast-forward方式就是当条件允许的时候,git直接把HEAD指针指向合并分支的头,完成合并。属于“快进方式”,不过这种情况如果删除分支,则会丢失分支信息。因为在这个过程中没有创建commit

     --no-ff:不使用fast-forward方式合并,保留分支的commit历史
    --squash:使用squash方式合并,把多次分支commit历史压缩为一次

     

    如果遇到冲突,在idea中,可以比对冲突代码,解决后再push

    Step 3. 将release分支push到gitlab上

    git push origin releases/branch

    参考文章

    http://rogerdudler.github.io/git-guide/

  • 相关阅读:
    The OpenGL pipeline
    HLS协议实现
    用C++设计一个不能被继承的类
    Ansible@一个高效的配置管理工具--Ansible configure management--翻译(八)
    史上最简单的软件破解——5行脚本代码完美破解99%的过期软件
    oracle11g创建新的用户和改动最大连接数
    【SICP感应】1 工艺和替代模式
    ant利用先进,ant订单具体解释,ant包,ant包装删除编译jar文件
    SqlServer表EXCEL数据复制的另一种方法
    【摘要干】如何执飞前写商业计划?
  • 原文地址:https://www.cnblogs.com/parkdifferent/p/9588647.html
Copyright © 2011-2022 走看看