Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jordihm9/5ca24df0096b6d038a04782b1dc6d072 to your computer and use it in GitHub Desktop.

Select an option

Save jordihm9/5ca24df0096b6d038a04782b1dc6d072 to your computer and use it in GitHub Desktop.

Revisions

  1. jordihm9 created this gist Jun 15, 2023.
    17 changes: 17 additions & 0 deletions force-update-changed-files-in-merge.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/usr/bin/env bash

    commit_hashes=$(git log --merges origin/$(git_main_branch)..${git_current_branch} --format="%H")

    for commit_hash in ${commit_hashes}; do
    files=$(git show ${commit_hash} --name-only --pretty=format: | sort | uniq | grep -E '\.(ts|tsx|js|jsx)$')

    for file in ${files}; do
    if [[ -e $file ]]; then
    echo "Processing ${file}"
    echo "" >> $file
    else
    echo "[SKIP] $file"
    fi
    done

    done