How get latest commit from gocd and detect did it change some specific folder?
<p>I'm using gocd continious delivery tool + git. My project consists of many subprojects. I don't want to rebuild all subprojects on each commit and thus created one pipeline for each subproject. I know, that for each pipeline, say for project1, I have to choose appropriate working dir and run smth like that:</p>

<ol>
<li>get git commit which triggered gocd build.</li>
<li>detect whether
changes in that commit contain project1 folder</li>
<li>if changes in
whole project also affected project1 folder run custom build command
for project1.</li>
</ol>

<p><strong>How may I get commit from gocd which triggered current build?</strong> Is it simply git's latest commit or not? I thing latest commit is not safe option in case of many concurrent commits, that's why I want to get it directly from gocd - I hope it stores it for each build trigger event. <strong>How detect commit affects on folder in bash?</strong></p>