Checkout: Diff between PR and master

Created on 20 Feb 2020  路  3Comments  路  Source: actions/checkout

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?

Most helpful comment

You're very welcome ;)
How about the mindset of "We are all stupid -- but we manage to do brilliant things from time to time!" (<-- me, justifying that I do much stupider things all the time XD )

All 3 comments

git diff origin/master HEAD

This works, thanks!
(Feeling a bit stupid now...)

You're very welcome ;)
How about the mindset of "We are all stupid -- but we manage to do brilliant things from time to time!" (<-- me, justifying that I do much stupider things all the time XD )

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thewavelength picture thewavelength  路  7Comments

luludan picture luludan  路  5Comments

chorrell picture chorrell  路  4Comments

rster2002 picture rster2002  路  7Comments

gitfool picture gitfool  路  3Comments