title: Why is the output of git diff-tree empty in my post-receive hook?
body: <p>I have a bare remote repository with source files in which I want to build only the changed files after it has been pushed to. I thought the best way to detect which files have been changed would be by putting the command 
  <code>changed_files=$(git diff-tree --no-commit-id --name-only -r HEAD)</code> into a post-receive hook.</p>
  
  <p>However, the variable ends up empty as I have verified by echoing it into a file. If I put HEAD^ instead of HEAD, it does show the changed files of the second to most recent commit. However, it doesn't show the most recent changes when I put HEAD but just shows nothing.</p>
  
  <p>Can anyone help me? Or is there a smarter approach to my problem altogether? </p>
  
  <p>I would definitely prefer a lean approach like automatically triggering a build with a push over one that would have to e. g. periodically check for changes.</p>