Can't get git-diff on CircleCI Job

I need a git diff of the files that have changed between my feature branch and develop. The list of changed files is fed into the rubocop linter to check for violations being pushed out with this branch.

When I run the following command locally, it returns a list of the changed files between HEAD and my develop branch:

git diff develop HEAD --name-only | egrep '.+/.+.rb'

When I run this on CircleCI (either as part of a job, or via SSH), the git-diff command returns no content.

Can anyone offer any insight into what I’m doing wrong?

Hi @Bodacious,

This is correct. Git in your CircleCI container is not the same as Git on your local machine. By default, git is not configured inside of your container.

One approach you might use is to compare your feature and develop branch within your container. Please feel free to share your config.yml file if you’s like me to chime in on a more detailed solution.