Skip to content

Instantly share code, notes, and snippets.

@christopinka
Last active July 29, 2024 13:47
Show Gist options
  • Save christopinka/1d1c37582b4f784c24f6b6c23213d026 to your computer and use it in GitHub Desktop.
Save christopinka/1d1c37582b4f784c24f6b6c23213d026 to your computer and use it in GitHub Desktop.
git - reset pull request to previous commit to get outgoing changes locally
taken from https://stackoverflow.com/a/72465195/2149240
good when you want to run static analysis on only the change set during a code review. And/or limit the scope of your review to only what's changed.
ex:
git fetch origin pull/65/head:test-branch
git checkout test-branch
git log # press 'q' to exit
git reset --soft 7d7fe166cd878ed70c559c4e98faf2323532
where the reset hash is the previous commit to the first commit for the pr.
$git show <pr-first-commit-hash>^1
@christopinka
Copy link
Author

christopinka commented Nov 29, 2023

where the reset hash is the previous commit to the first commit for the pr.

$git show <pr-first-commit-hash>^1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment