Use repositories to protect your work

Software developers use repositories to protect their work. If you work with many text files, you should too.

Repositories are snapshots of your work, stored on a timeline. You can use a repository for any collection of text files. My work happens to be web programming, but you could set up a repository to track legal documents, book chapters, or spreadsheets. (Note: you can also store binary files such as photos, music, or videos in a repository, but you don’t get the benefits of merging discrete changes (see below).)

Repositories protect your work and give access to its history of changes. Repositories allow you to boldly forge ahead with changes because you can always get back to a stable point in history if you need to.

Working in branches

When using a repository, the best practice is to create a new branch (a new snapshot of your work) any time you have more than just a few minutes’ work to do. (If you are working on a “branch,” then the “trunk” is that snapshot you took before you started making changes.)

As you complete tasks, or when you break for lunch or at the end of the day, you check in new snapshots. You keep working until you reach a stable point where you’re ready to share your work with others. Once your current task is complete, you merge your branch back into the trunk.

The neat thing about working in a branch is that, if at any time your colleagues need to see a good, clean copy of your work, you can give them a snapshot of the trunk, and it won’t have all the half-finished work that you have been saving in your branch.

A new dimension

If a repository were only a string of snapshots, it would be very low-tech. You could create your own “repository” just by storing copies of your work in folders marked with the date. It’s a one-dimensional timeline of your work.

What makes repository software like Subversion or Git so high-tech is that they know how to detect just the differences between one version and the next, which makes it possible to merge changes. Subversion and Git therefore allow you to work simultaneously with any number of colleagues.

Repositories are two-dimensional, allowing any number of parallel timelines, one for each colleague on your team.

Collaborating using a repository

Here’s how.

In the beginning, there was the trunk. “The beginning” is the day you decide to adopt a repository. The trunk is the baseline from which all work will flow and back into which all worthy work will return.

As each member of the team is assigned a task, he or she creates their own branch, starting from the trunk. Any number of people can be working on an individual branch, and still, there is a stable trunk for use by clients, colleagues, and bosses.

When you finish your work and it is ready to share, you merge your changes into the trunk. And because repository software knows about changes and merging, each of your colleagues can  perform the same merge of your changes into their work.

Occasionally, you will have changed the same exact line in the same exact file in a way that conflicts with one of your colleagues’ work. But repositories will show you these conflicts and ask you to resolve them the old-fashioned way…

… by talking to your colleagues and settling on the solution.

Advertisements
This entry was posted in Information Architecture, Repositories, Web programming. Bookmark the permalink.

One Response to Use repositories to protect your work

  1. gcbenison says:

    I think even for binary content (i.e. content for which merging doesn’t work too well), git is superior to a collection of folders or files marked with dates. First, git enforces consistency in how older versions are stored. Its digital signing removes any ambiguity from “which version is this”… even when working across different machines with different people. It keeps track of the _lineage_ of revisions even for binary content – something less likely to be achieved using an ad-hoc folder system.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s