Do deploy previews re-deploy when you push a new commit?

Netlify deploys a deploy preview when I open a pull request in Github.

But it doesn’t seem to trigger a new build if I push changes to that pull request.

Is that supposed to work? Here are my Netlify deploy settings:

It sort of works if I turn on “Branch deploys: All”, but then I seem to get double builds (both a deploy preview AND a branch deploy).

Site name is: sidebarweb

Thanks!

Yup, you should be able to achieve your stated goal. With that pictured configuration we should build:

  • any commit to the production branch
  • any commit to the staging branch
  • any PR TARGETING the production or staging branch (but not a PR targeting other branches!).

Does that not match your experience?

Is it possible to build only the selected branches? I don’t want the other PRs targeting them to be build.

The default/built-in setting to build PR’s or not is “all configured branches”.

If you want to modify that behavior, there are a few ways you can get there, such as posting your commit webhooks from your git provider to an intermediary service like zapier where you can filter them and only send the ones you want us to build onwards.

As far as “no additional services needed” options, and probably the one I’d recommend, you can use the build.ignore script to run git commands to see details about the commit and choose to return true on the ones you don’t want to build:

1 Like

Ah! I needed to add master to “Additional branches”. (since I’ve set my Production branch to production)

Without master, it would still do an initial deploy preview when you opened a Pull Request against master, but it wouldn’t re-deploy if you pushed new commits to those PRs.

Thanks for the specifics, @fool, those details made me realize I was missing master.