{"id":117,"date":"2012-03-11T22:44:17","date_gmt":"2012-03-11T22:44:17","guid":{"rendered":"http:\/\/boulderinformationservices.wordpress.com\/?p=117"},"modified":"2012-03-11T22:44:17","modified_gmt":"2012-03-11T22:44:17","slug":"use-repositories-to-protect-your-work","status":"publish","type":"post","link":"https:\/\/boulderinformationservices.com\/blog\/use-repositories-to-protect-your-work\/","title":{"rendered":"Use repositories to protect your work"},"content":{"rendered":"<p><a href=\"http:\/\/boulderinformationservices.com\/blog\/wp-content\/uploads\/2012\/03\/beautiful_git_tree.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-115\" title=\"Beautiful Git Tree (from Tower)\" src=\"http:\/\/boulderinformationservices.com\/blog\/wp-content\/uploads\/2012\/03\/beautiful_git_tree.png\" alt=\"\" width=\"105\" height=\"802\" \/><\/a>Software developers use repositories to protect their work. If you work with many text files, you should too.<\/p>\n<p>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&#8217;t get the benefits of merging discrete changes (see below).)<\/p>\n<p>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.<\/p>\n<h2>Working in branches<\/h2>\n<p>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&#8217; work to do. (If you are working on a &#8220;branch,&#8221; then the &#8220;trunk&#8221; is that snapshot you took before you started making changes.)<\/p>\n<p>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&#8217;re ready to share your work with others. Once your current task is complete, you merge your branch back into the trunk.<\/p>\n<p>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&#8217;t have all the half-finished work that you have been saving in your branch.<\/p>\n<h2>A new dimension<\/h2>\n<p>If a repository were only a string of snapshots, it would be very low-tech. You could create your own &#8220;repository&#8221; just by storing copies of your work in folders marked with the date. It&#8217;s a one-dimensional timeline of your work.<\/p>\n<p>What makes repository software like Subversion or Git so high-tech is that they know how to detect just the <em>differences<\/em> between one version and the next, which makes it possible to <em>merge<\/em> changes. Subversion and Git therefore allow you to work simultaneously with any number of colleagues.<\/p>\n<p>Repositories are two-dimensional, allowing any number of parallel timelines, one for each colleague on your team.<\/p>\n<h2>Collaborating using a repository<\/h2>\n<p>Here&#8217;s how.<\/p>\n<p>In the beginning, there was the trunk. &#8220;The beginning&#8221; 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.<\/p>\n<p>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.<\/p>\n<p>When you finish your work and it is ready to share, you <em>merge<\/em> your changes into the trunk. And because repository software knows about changes and merging, each of your colleagues can\u00a0 perform the same <em>merge<\/em> of <em>your<\/em> changes into <em>their<\/em> work.<\/p>\n<p>Occasionally, you will have changed the same exact line in the same exact file in a way that conflicts with one of your colleagues&#8217; work. But repositories will show you these conflicts and ask you to resolve them the old-fashioned way&#8230;<\/p>\n<p>&#8230; by talking to your colleagues and settling on the solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/boulderinformationservices.com\/blog\/use-repositories-to-protect-your-work\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,13,16],"tags":[],"_links":{"self":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/posts\/117"}],"collection":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/comments?post=117"}],"version-history":[{"count":0,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/posts\/117\/revisions"}],"wp:attachment":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/media?parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/categories?post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/tags?post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}