Skip to content

Instantly share code, notes, and snippets.

@paoloricciuti
Last active September 26, 2025 08:09
Show Gist options
  • Select an option

  • Save paoloricciuti/f355d2e6111817d1b8194e1c0488a9cf to your computer and use it in GitHub Desktop.

Select an option

Save paoloricciuti/f355d2e6111817d1b8194e1c0488a9cf to your computer and use it in GitHub Desktop.
snippet to find the changed files from a git patch
const files = [...patch.matchAll(/^diff --git\sa\/(?<file>.+?)\sb\/\1\n(?:(?<action>deleted|new)\sfile mode)?/gm)].map(res => res.groups);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment