I want to check the formatting of modified Python files in Azure DevOps. I'm only using git branch -a
to see what's going on. I don't have permissions to use git fetch
.
Currently running this:
jobs:
- job: Linting
displayName: Format code
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.x
- script: |
pip install black
displayName: 'Install Black'
- script: |
git branch -a
git diff --name-only origin/master...HEAD --diff-filter=AM | grep '\.py$' | xargs black --check
displayName: 'Format files'
Which gives me this error:
* (HEAD detached at origin/11111111111xxxxxx)
remotes/origin/11111111111xxxxxx
fatal: ambiguous argument 'origin/master...HEAD': unknown revision or path not in the working tree.
I branched directly off of master for my changes. I don't have any issues running this locally.
How can I fix this?