I have two branch:
- develop
- myBranch
I'm working on myBranch and some other makes a push on develop.
So now I should merge my branch "myBranch" into develop.
So I'll checkout on develop, i'll make a pull and then can I merge "myBranch" ?
git checkout develop
git pull
git merge myBranch
it is rigth in your opinion?
CodePudding user response:
You should first merge devel
into myBranch
until you are ready to incorporate your changes into devel
. Another developer pushing to devel
does not require you to do the same immediately.
# Get any new changes from the remote
git fetch
# You don't necessarily need to update your copy of devel yet;
# just merge the new commits from devel into myBranch
git merge origin/devel
# continue working on myBranch
# Time to merge your changes to devel.
git checkout devel
git pull
git merge myBranch
Merging devel
into myBranch
while you develop lets you resolve any merge conflicts as they come along, rather than having to resolve all of them at once when you finally merge myBranch
into devel
. If you merge often, you should minimize, if not eliminate, the merge conflicts during git merge myBranch
.
CodePudding user response:
You don't need to do the git pull
, that would be pulling the changes from remote.
If you want to just merge, then it's:
git checkout <branch to merge into>
git merge <feature branch>