Over a million developers have joined DZone.

Git/Mercurial: Pushing Regularly

· Java Zone

Learn more about how the Java language, tools and frameworks have been the foundation of countless enterprise systems, brought to you in partnership with Salesforce.

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:


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

Discover how the Force.com Web Services Connector (WSC) is a code-generation tool and runtime library for use with Force.com Web services, brought to you in partnership with Salesforce.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}