I have a test branch and of course there is a master branch!!
The master branch contains several projects.
I have made several changes to 'one' of those projects.
So master is ahead on all the other projects, and behind on mine.
There is one other developer working on the same project as me, but she is working directly on master.
I'd like to merge my branch into master :/
This is how I 'think' it should go.
git checkout test
git pull --rebase (make sure my test branch is up to date)
git merge master (make sure my branch is in sync with master as much as possible, whilst preserving my changes).
'git add file xyz and so on to resolve any conflicts
git checkout master
git merge test (I believe this should now work smoothly without conflict).
#1 Do my steps look correct?
#2 After a git merge, is it necessary to do a git push? (both master and test are remotes
The way I usually go about this is by using git rebase. So my steps would be something like this (right from the very beginning before changing anything in my test branch):
If there are any conflicting changes, the rebase process will pause and show you the conflicts and you can then fix the conflicts and do a git add/rm depending on the way you want to resolve them and then continue the rebase by issuing git rebase --continue
Once the rebase is complete your local test branch will now have all the commits from remote master branch plus your local commit on top of them. Remember though that all of this is still local. So if you want to push this to the test branch of the remote repo you just issue a push:
Assume you were the one who did the local commit xyz and commit pqr after you had created the test branch from the master branch. Now assume your teammate did a commit mno in the remote master branch. Now when you do the rebase as I suggested in the previous post, after a successful rebase the commit history will be:
So as you can see, the local commits were literally rebased "on top of" what's there in the remote master branch.