Most common scenario:
Checkout the sources from a “remote branch” into your “local copy”. Continue working there until you reach a point were your changes are good enough to be committed. In order not to deviate too much from the remote branch you often update your local copy.
PROS
- Easy to understand.
- No overhead in smaller projects.
- Cannot commit sometimes for days. Especially in bigger teams the cost of breaking the remote branch can be very high.
- Cannot go back in time in your local work. If you mess up half way through your implementation then there is no safe point… No one is controlling your local history.
Private Remote Branch:
Create a branch for your self only “private branch”. Checkout the sources from the “private branch” into your local copy. Frequently commit your changes into the “private branch”, even if you have not yet reached a point were your changes are good enough to be committed into the “team branch”. In order not to deviate too much from the “team branch” often merge changes into your “private branch”. When you are ready to commit to the “team branch” simply switch your local copy to that branch, stabilize and commit.
PROS
- You can go back in history for all local work since you can afford to commit any time you like.
- Once you grasp this concept you will typically make less and better commits to the team branch with better and more meaning full comments.
- If necessary you can build your interim work in the build server or even share it with a co developer for reviewing.
- The merging from the “team branch” to your “private branch” is really easy… basically equal to updating a local copy (since you are the only contributor to the “private branch”).
- Overhead for a small project
- More difficult to understand
- Some source controls have shelving facilities. Example in TFS you can shelve your changes. This is not exactly equal to what has being described above (in TFS you shelve a state of your workspace with a name), but in most cases is more than enough.
- Distributed source controls support private branches locally (you can locally commit). Again this is not exactly equal to the picture above (what if I loose my notebook?) but it is in most cases more than enough!
0 comments:
Post a Comment
Post a comment