Skip to content

Diff between PR and master #160

@grst

Description

@grst

Hi,

I am trying to obtain a diff between the current HEAD of a PR and the master branch.
I understand that checkout only fetches the latest revision of the current branch only, so
I tried the approach to fetch all branches from the README.

- uses: actions/checkout@v2
- run: |
    git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- run: git diff master HEAD    

This fails with

Run git diff master HEAD
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
##[error]Process completed with exit code 128.

Running git diff master HEAD on a local copy of the repository works fine:

git clone <repo>
git checkout pr-branch
git diff master HEAD

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions