Keeping track of your deploys with capistrano and git

Posted by Tiago Scolari on Feb 19, 2012
In Development, Server, Ruby

I’ve created a simple capistrano task to keep track of my deploys. When I deploy to a server, it will create a git tag and push it to origin. This way I can keep track of each deploy revision.

after 'deploy:update_code', 'git:create_deploy_tag'

namespace :git
  task :create_deploy_tag do
    puts "[git] creating new deploy tag"
    tag_name = "deploy--#{"%Y-%m-%d-%H-%M-%S")}"
    `git tag -a '#{tag_name}' -m 'Deploy: #{}' origin/production && git push origin --tags`

p.s: I use the production branch as my deploy branch. You can change it for master, or anything else.