Skip to content

Instantly share code, notes, and snippets.

@AvnerCohen
Created November 27, 2019 20:13
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 AvnerCohen/3401cc369b92b9948560f19daa9ed151 to your computer and use it in GitHub Desktop.
Save AvnerCohen/3401cc369b92b9948560f19daa9ed151 to your computer and use it in GitHub Desktop.
Show List of files changed since last commit - allow to feed that into CI operations that needs some optimization, say linting on YAMLs
#!/bin/bash -e
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git diff --name-only --diff-filter=ACM $LATEST_TAG HEAD
@AvnerCohen
Copy link
Author

Filtering for only YAMLs, for example:

#!/bin/bash -e
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git diff --name-only --diff-filter=ACM $LATEST_TAG HEAD -- '*.y*ml'

@look4regev
Copy link

👍🏻👍🏻

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