Ad

How To Check Git If Folder Has Been Changed

- 1 answer

I have a Powershell script that deploys a number of projects. But since both the number of projects and the time to deploy each project are rather large, I'd like to only deploy them when I need to: when there's a change in version control. We have this set up on the development server, but I'd like to also do it on local machines, without installing Octopus or TeamCity.

How to ask in a powershell script if Git has made any changes within a folder?

Edit: I'd need to know whether there have been any changes since the last deployment. A listener on updates coming through git, or saving deploy times of each project and comparing that to the latest update on that project would work.

Ad

Answer

$changes = git whatchanged --since 2015-12-22
if($changes | Select-String $dbName)
{
  #Deploy database because there's been a change
}
Ad
source: stackoverflow.com
Ad