Use git log --follow to get commits collection. Closes #6966

Based on pull request #3502 from akzhan.