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/

  • 相关阅读:
    关于螺旋矩阵的问题
    JDK 1.5 for 循环的新写法
    Java基础视频笔记(三)
    关于接口的理解
    常用的DOS命令
    Java基础视频笔记(二)
    Eclipse的常用快捷键备忘
    Java基础视频笔记(四):泛型
    异常设计准则
    多重继承和虚继承的内存布局(转)
  • 原文地址:https://www.cnblogs.com/parkdifferent/p/9588647.html
Copyright © 2011-2022 走看看