Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff between PR and master #160

Closed
grst opened this issue Feb 20, 2020 · 3 comments
Closed

Diff between PR and master #160

grst opened this issue Feb 20, 2020 · 3 comments

Comments

@grst
Copy link

grst commented Feb 20, 2020

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?

@mbargull
Copy link

git diff origin/master HEAD

@grst
Copy link
Author

grst commented Feb 20, 2020

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

@mbargull
Copy link

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 )

cyqsimon added a commit to cyqsimon/bat that referenced this issue Nov 3, 2023
cyqsimon added a commit to cyqsimon/bat that referenced this issue Nov 3, 2023
cyqsimon added a commit to cyqsimon/bat that referenced this issue Nov 3, 2023
Fetch the base branch and diff correctly

- See: actions/checkout#160

Improve organisation

Add some echo for easier debugging

Fix bad variable syntax

Clarify the double-print in the success case
Enselic pushed a commit to sharkdp/bat that referenced this issue Nov 3, 2023
* Added changelog item check

Fetch the base branch and diff correctly

- See: actions/checkout#160

Improve organisation

Add some echo for easier debugging

Fix bad variable syntax

Clarify the double-print in the success case

* Write to changelog

* Don't block dependabot PRs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants