Skip to content

Instantly share code, notes, and snippets.

@nottrobin
Created June 9, 2022 21:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Find latest commit, check for modified articles in it, check if it was added in this commit
#! /usr/bin/env bash
commit_id=$(git log --format="%H" -n 1)
articles=( $(git diff --name-only HEAD HEAD^ | egrep '^_articles') )
for article in "${articles[@]}"
do
article_added_in=$(git log --pretty=format:"%H" --diff-filter=A -- $article)
if [ "$commit_id" = "$article_added_in" ]; then
echo $article
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment