CI/CD Pipeline - Get list of Modified files

I am running the below command in my pipeline and it throws an error that
git command not found

command:
git diff-tree --no-commit-id --name-only -r

I am trying to capture list of changed files in my pipeline , if there is another way we can achieve this please share.