Git相关

作者: 07120665a058 | 来源:发表于2018-09-06 23:00 被阅读21次
    • 更新 fork 的仓库
    git remote add upstream https://github.com/whoever/whatever.git
    git fetch upstream
    git checkout master   # Make sure that you're on your master branch:
    git rebase upstream/master
    

    https://github.com/lxconan/java/blob/master/src/test/java/com/cultivation/javaBasicExtended/myUnitTestFramework/UnitTestRunner.java

    • merge分支到master
    (dev-branch)$ git merge master   //(resolve any merge conflicts if there are any)
    git checkout master
    git merge dev-branch            //(there won't be any conflicts now)
    

    https://stackoverflow.com/questions/14168677/merge-development-branch-with-master

    merge

    • 自动创建一个新的commit
    • 如果合并的时候遇到冲突,仅需要修改后重新commit
    • 优点:记录了真实的commit情况,包括每个分支的详情
    • 缺点:因为每次merge会自动产生一个merge commit,分支很杂乱

    rebase

    • 会合并之前的commit历史
    • 优点:得到更简洁的项目历史,去掉了merge commit
    • 缺点:如果合并出现代码问题不容易定位
    git add .
    git rebase --continue
    

    https://www.atlassian.com/git/tutorials/merging-vs-rebasing

    相关文章

      网友评论

          本文标题:Git相关

          本文链接:https://www.haomeiwen.com/subject/gydviftx.html