Can I diff two deploys?

I’m considering Netlify for hosting of my hobby website. I’m pretty happy with what I see, and using Netlify would push me to do couple of things I was planning to do anyway (like getting my images under source control). The Netlify-powered beta looks okay, and I’m currently looking at how my dev workflow would need to be changed to accommodate this change.

I was wondering whether there’s a way for me to diff two deploys. With the old way of serving my page (generate a public tree, push it to serving via ftp), I’d keep the generated files permanently under source control so I could verify whether the changes I’m making are really what I intended to achieve. This also allows me to easily refactor different parts of my generator while making sure the generated content stays the same. The preview is nice, but it only goes so far in terms of confirming changes.

Example for my current setup:

In fairness, this is not a problem specific to netlify - it’s a general problem for sites powered by static site generators that don’t keep the output checked in. I can think of some sort of workaround: generate output at specific commit, save it to a dir, then, when needed, diff against it. This is an avenue I’d rather avoid if I can :smiley:

Anyone else had a problem like that? :3

Hi @yacoob, I would just use git which provides diffing capabilities. You don’t need to save the output of a static build since given the same source, you should have the same output. If your source is markdown files then having those in version control would help you keep track of changes there as well.

In the end, I went with checking a set of html files into the repo itself. My build is effectively a sum of two filesets: a bunch of files copied directly from static/ and some content generated from a bunch of .yaml files:

I really wanted to be able to diff the latter - to confirm whether the change I’m making has a desired effect. Like here: I make some changes to the templates (1, 2) and can instantly see what is the delta against the current set of “golden” files. Once I’m happy, I can publish the site, and update the set of goldens.

The downside of this approach:

  • you need to keep that dir with goldens, which is a bit of a waste
  • you need to keep the goldens updated; not necessarily with every commit, but every now and then when you make a major change
  • you need to face the fact that most of the time, comment on your latest deploy will be ‘Update golden files’.

I can keep the goldens outside of the repo or in a completely detached branch. Not a clean solution. If I had a way to diff deployments, I’d be able to point at two commits and say “show me a difference between those two”.

Hmm, maybe I can automate that. :smiley:

Thanks for coming back and sharing your solution @yacoob!

…and I came up with a slightly nicer solution. I just need to remember to run $(make golden-build) before I start changing things.

This should be workable. :slight_smile:

1 Like