Merge Between Two Branches in git
To Merge the current origin/master into a feature branch
----------------------------------------------------------
We need to ensure that the code that your changes in the feature branch still work with the latest changes that have been applied to master whilst you have been developing your feature.
- Make sure you have the latest code from the remote with: git fetch
- Make sure you are on your LOCAL FEATURE branch that was created using the REMOTE FEATURE branch: git checkout myFeature
- Make sure your LOCAL FEATURE branch is in line with the HEAD of the REMOTE FEATURE branch: git rebase origin/myFeature
- Merge origin/master to your LOCAL FEATURE branch: git merge origin/master
You now have the latest changes from the REMOTE MASTER in your LOCAL FEATURE branch.
- Perform a FULL build and test
- If there are any issues fix them then git add … etc… and finally a git commit
- Push this new commit to the remote branch: git push origin HEAD:refs/for/myFeature
- You may have to manually add a gerrit change id to the commit message as the 'git hook' that automatically adds this is setup for the commit operation and not the merge operation.
You now have your feature merged together with the latest code from origin/master pushed to you REMOTE FEATURE branch.
- Request QA to generate a new build off the FEATURE BRANCH, to run fitness tests against it and do any other necessary testing
Merging code to master (http://www.gitguys.com/topics/merging-branches-without-a-conflict/)
To merge the current feature branch into origin/master :
------------------------------------------------------------
i) Make sure you have the latest code from the remote with git fetch
ii) Make sure you are on local master git
iii) Make sure your local master is in line with the HEAD of the origin/master git rebase origin/master
iv) This step has an extra flag it is not the same as step iv) in the previous steps - Merge the feature branch locally git merge –no-ff origin/appliedratecube
v) If there are any issues fix them then git add … etc… and finally a git commit
vi) Push this new commit to origin/master (you may have to manually add a gerrit change id to the commit message) git push origin HEAD:refs/for/master
To Merge the current origin/master into a feature branch
----------------------------------------------------------
We need to ensure that the code that your changes in the feature branch still work with the latest changes that have been applied to master whilst you have been developing your feature.
- Make sure you have the latest code from the remote with: git fetch
- Make sure you are on your LOCAL FEATURE branch that was created using the REMOTE FEATURE branch: git checkout myFeature
- Make sure your LOCAL FEATURE branch is in line with the HEAD of the REMOTE FEATURE branch: git rebase origin/myFeature
- Merge origin/master to your LOCAL FEATURE branch: git merge origin/master
You now have the latest changes from the REMOTE MASTER in your LOCAL FEATURE branch.
- Perform a FULL build and test
- If there are any issues fix them then git add … etc… and finally a git commit
- Push this new commit to the remote branch: git push origin HEAD:refs/for/myFeature
- You may have to manually add a gerrit change id to the commit message as the 'git hook' that automatically adds this is setup for the commit operation and not the merge operation.
You now have your feature merged together with the latest code from origin/master pushed to you REMOTE FEATURE branch.
- Request QA to generate a new build off the FEATURE BRANCH, to run fitness tests against it and do any other necessary testing
Merging code to master (http://www.gitguys.com/topics/merging-branches-without-a-conflict/)
To merge the current feature branch into origin/master :
------------------------------------------------------------
i) Make sure you have the latest code from the remote with git fetch
ii) Make sure you are on local master git
iii) Make sure your local master is in line with the HEAD of the origin/master git rebase origin/master
iv) This step has an extra flag it is not the same as step iv) in the previous steps - Merge the feature branch locally git merge –no-ff origin/appliedratecube
v) If there are any issues fix them then git add … etc… and finally a git commit
vi) Push this new commit to origin/master (you may have to manually add a gerrit change id to the commit message) git push origin HEAD:refs/for/master