Created
June 15, 2023 21:32
-
-
Save jordihm9/5ca24df0096b6d038a04782b1dc6d072 to your computer and use it in GitHub Desktop.
Add an empty line at the end of every file changed in every merge commit from the current branch compared to the main branch of the repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment