Working on a single branch- update-merge explainedWhile our recommended pattern is definitely “branch per task”, sometimes you’ll find yourself sharing a branch with another developer or even the whole team. This post will explain the two common situations and how Plastic SCM solves them.
Scenario 1- Working on the same branch without conflictsSuppose you’re working on your branch, you check the branch explorer and you see your situation is like this:
You actually have some changes pending to be committed and you just continue working on them. Your changes are:
Meanwhile, another developer ends up with his changes that don’t collide with yours, and later decides to checkin:
Now you go and check your branch explorer and see that now you’re “behind the head” of the branch:
If you now try to check-in Plastic will warn you telling that you might have conflicts:
You can go and check the changes of this last cset and since you see they do not conflict with yours, you can just go to the root of your workspace and run an “update”.
Plastic SCM will detect that your changes do not collide with the new branch head and will be able to move you to the new head, downloading the new changes. You’ll be again synced with the head and ready to checkin without merge:
Scenario 2 – Synchronizing colliding changesLet’s go back to the beginning: you’re working on your branch and modified the following files:
At the same time your colleague modified the following:
Ok, the two first files are colliding!
Your colleague now is faster than you and checkins his.
So now your workspace is behind.
You try to checkin and see again the “merge needed” dialog:
Please note that the merge-needed dialog brings you the option to start a new branch, which is really convenient!!
You can press “Ok” and merge, or you can try to update your workspace as you did before. Now, if you try to update the workspace, since there are colliding changes, the system will warn you:
And the following merge dialog will show up:
You see there’s a “merge in progress” pointing from the head of the branch to the changeset you’re working on (calm down directed-acyclic-graph purists... this is just a way to show the merge in progress and most likely we will modify it to render the “in progress” changeset too!!)
Now you’re ready to checkin and once you do it you’ll get: