search

Home  >  Q&A  >  body text

Version Control - Git multi-person development, how to avoid switching back and forth when merging branches?

In multi-person development, you should often merge other people’s branches into your own branch.
My approach is to switch to other people’s branches first, then pull them down to the latest, and then switch to my own branch. Finally merge other people's branches into my own branch. Have to switch back and forth every time. It feels very troublesome. Is there a better way?

PHP中文网PHP中文网2768 days ago665

reply all(4)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:31:04

    It stands to reason that under normal circumstances, there is no situation where you merge with other people's branches, because there should only be one branch on the remote end (server side) (distinguish between development version, release version, etc.), and it should be cloned locally by multiple people. The remote branch will be pushed to this branch after the modification is completed. If there is a conflict in the push (someone else modified the remote branch first), pull it first to merge it, and then push it. This way, there is no hassle of switching branches back and forth.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-02 09:31:04

    git fetch ; git merge origin/他的分支

    reply
    0
  • PHPz

    PHPz2017-05-02 09:31:04

    In your branch

    git pull origin 他人分支

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-02 09:31:04

    git fetch origin
    git merge origin/branch_name

    reply
    0
  • Cancelreply