Where developers come to connect, share, build and be inspired.

20

Why timestamp each deployment with Git tag?

1045 views

I have recently started using capistrano-deploytags. It creates timestamped Git tag at each deployment.

For production deployment:

cap production deploy

It creates tag:

production-2013.04.16-123456

For staging deployment:

cap staging deploy

It creates tag:

staging-2013.04.16-123456

Having those tags, you can add this to your ~/.gitconfig

[alias]
   pdiff = !TAG=$(git describe --no-abbrev --tags --match production-*) && git diff $TAG
   sdiff = !TAG=$(git describe --no-abbrev --tags --match staging-*) && git diff $TAG

Those aliases allow you see all commits that you are about to deploy to staging or production. It makes it faster to do check code changes before they are deployed to production and write better customer update mails.

After deployment with capistrano-deploytags and making a few commits an/or local changes, you can view diff to what is deployed to production with

git pdiff

Comments

  • 372345_23304565_2127851301_n
    clepore

    Any thoughts on the error I keep getting about a "bad config" file when I add those two lines in?

  • Blank-mugshot
    tb

    @clepore It was _ in alias name, fixed.

Add a comment