Skip to content

Instantly share code, notes, and snippets.

@nottrobin
Created June 9, 2022 21:13
Show Gist options
  • Select an option

  • Save nottrobin/4356719f2f7f4c6834bdebe5fa7bf327 to your computer and use it in GitHub Desktop.

Select an option

Save nottrobin/4356719f2f7f4c6834bdebe5fa7bf327 to your computer and use it in GitHub Desktop.

Revisions

  1. nottrobin created this gist Jun 9, 2022.
    15 changes: 15 additions & 0 deletions find-changed-files.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #! /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