1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Retrieving a Tagged Release


Once you have releases tagged in the repository, it will be useful to retrieve tagged releases. For example, I want to see if a bug was present in version 0.3, so I'll want to retrieve version 0.3 and run it. Git, of course, makes this easy.

The easiest way to go back to an earlier version to examine it is to clone the repository. To do this, use the git clone command. The first argument is the repository to clone. In this site, it's in a directory called site. The second is the destination directory, in this case we'll call it site-1.0.

$ git clone site site-1.0
Initialized empty Git repository in /home/uzimonkey/tmp/site-1.0/.git/

Once the repository is cloned, the HEAD will be at master. To go back to version 1.0, we'll need to check out version 1.0, making HEAD point to the state of the tree when 1.0 was tagged. This, again, is a simple command. Change directory to your cloned repository and issue the command git checkout v1.0.

$ git clone site site-1.0
Initialized empty Git repository in /home/uzimonkey/tmp/site-1.0/.git/
$ cd site-1.0
$ git checkout v1.0
Note: moving to "v1.0" which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
HEAD is now at f306a95... Initial import
  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Using the Git Version Control Tool with Ruby
  6. Retrieving a Tagged Release

©2014 About.com. All rights reserved.