zoukankan      html  css  js  c++  java
  • Git pull --rebase vs. --merge

    https://sdqweb.ipd.kit.edu/wiki/Git_pull_--rebase_vs._--merge

    Git pull --rebase vs. --merge

     
     
    This page briefly explains the difference between rebasing and merging in git while pulling. Both techniques are used to combine your local unpublished changes with the published remote changes. There is another wikipage on how to rebase or merge a branch.

    If you want to understand the details of rebasing and merging for changes and branches, then syou should read a blogpost by Mislav Marohnić and the chapter on rebasing and merging from the Pro Git book.

    rebasing

    If you pull remote changes with the flag --rebase, then your local changes are reapplied on top of the remote changes.

    git pull --rebase

    merging

    If you pull remote changes with the flag --merge, which is also the default, then your local changes are merged with the remote changes. This results in a merge commit that points to the latest local commit and the latest remote commit.

    git pull --merge

    best practice

    It is best practice to always rebase your local commits when you pull before pushing them. As nobody knows your commits yet, nobody will be confused when they are rebased but the additional commit of a merge would be unnecessarily confusing. Published commits are, however, usually merged, for example when branches are merged.

    To avoid typing --rebase whenever you pull you can config git to use it as default:

    git config --global pull.rebase true

    If you want to combine local commits before pushing them upstream, for example, because you discovered a typo or bug after a commit, you can do this interactively:

    git rebase -i

    If you want to know the details or have an old git version, follow the literature pointers above.

    What Doesn't Kill Me Makes Me Stronger
  • 相关阅读:
    linux 时间设置
    linux
    linux 关闭防火墙
    GIS-008-ArcGIS JS API 全图
    GIS-007-Terrain跨域访问
    GIS-006-ArcGIS API 空间关系
    Python 中文乱码
    GIS-005-Dojo & jQuery 事件处理
    GIS-004-Cesium版权信息隐藏
    GIS-003-在线地图下载及应用
  • 原文地址:https://www.cnblogs.com/kungfupanda/p/15365666.html
Copyright © 2011-2022 走看看