Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Git/Mercurial: Pushing Regularly

DZone's Guide to

Git/Mercurial: Pushing Regularly

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

I was reading a recent blog post by Gabriel Schenker where he discusses how his team is making use of Git and about half way through he says the following:

When using Git as your SCM it is normal to work for quite a while – maybe for a couple of days – in a local branch and without ever pushing the changes to the origin. Usually we only push when a feature is done or a defect is completely resolved.

We've been using Mercurial on the project I'm currently working on over the past few months and although it's a similar tool we've been following a different approach.

We've got it setup the same way we would setup Subversion:

dscm.gif

We've been trying to push to the central repository as frequently as possible, just as we would if we were using Subversion.

I don't know the Git workflow that well because I haven't used it on a project yet but we've always found that it's beneficial to integrate with code being written by others on the team as frequently as possible.

Not doing this can lead to the problems which Martin Fowler outlines in his post about feature branches.

We've tried to ensure that after every commit the build still passes although we do sometimes have broken versions in the code committed locally because we don't run our full test suite before every local check in.

Even if a feature isn't completed I still think it's valuable to have whist we've done so far checked in and it also helps remove the problem with needing to backup local repositories:

Since we are going to work locally potentially for days without pushing to the origin (our central repository) we might well loose our work if we have a hard disk crash or our office is flooded. Thus we need some backup strategy.

We just need to make sure the central repository is being backed up and then the danger of losing our work is significantly reduced.

 

From http://www.markhneedham.com/blog/2010/06/19/gitmercurial-pushing-regularly

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}