search

Home  >  Q&A  >  body text

`git merge origin master` 和 `git merge origin/master`的区别在哪里?

git merge origin mastergit merge origin/master的区别在哪里?

通过试验,我没有找到他们的区别。看起来又好像有去区别。

黄舟黄舟2793 days ago1022

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-04-24 16:02:59

    git merge branchA branchB, branchB generally defaults to the current branch, so

    git merge origin master //将origin merge 到 master 上
    git merge origin/master //将origin上的master分支 merge 到当前 branch 上 
    

    Generally when performing a merge operation, it is best to first checkout to the branch you want to perform the merge operation, that is, branchB, and then proceed

    git merge branchA //默认为当前branch,即branchB
    

    Because you cannot ensure whether a confit is generated, checkout to branchB first.
    In addition, to be on the safe side, you can create a backup branch before merging

    git checkout -b branchB_backup
    

    This way, even if something uncontrollable happens after you merge, you can still check back.

    reply
    0
  • Cancelreply