版本控制 - Git 多人开发,合并分支如何避免来回切换?
PHP中文网
PHP中文网 2017-05-02 09:29:04
0
4
663

在多人开发中,要经常合并别人的分支到自己的分支中。
我的做法是先切换到他人的分支,然后拉下来到最新,再切换到我自己的分支。最后合并他人的分支到我自己的分支。每次都要来回切换。感觉很麻烦。有更好的办法吗?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
给我你的怀抱

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.

大家讲道理

git fetch ; git merge origin/他的分支

PHPzhong

In your branch

git pull origin 他人分支
習慣沉默

git fetch origin
git merge origin/branch_name

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template