Skip to content

Instantly share code, notes, and snippets.

@louy
Created November 6, 2023 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louy/1c8a5360db5436e991185df3a2f570ac to your computer and use it in GitHub Desktop.
Save louy/1c8a5360db5436e991185df3a2f570ac to your computer and use it in GitHub Desktop.
`git diff --name-status` using `gh` GitHub CLI
# git diff --name-status
gh api repos/$OWNER/$REPO/compare/$HEAD...$BASE | jq -r '
.files[] |
(
(
if .status == "modified" then "M"
elif .status == "added" then "A"
elif .status == "removed" then "D"
else "?"
end
)
+ "\t" + .filename
)
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment