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?
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/他的分支
In your branch
git fetch origin
git merge origin/branch_name