From the README.md:
If you create merge-commits against your release/target branch, then changes to files in your release/target branch become part of the commit also. Those currently won't be filtered out. I'm not sure if there is a way to detect/filter out those files in a commit that are caused by the merge while keeping the "actual" changed files.
I'm not sure I'm understanding correctly the problem, are you asking if there is a way to filter out merge commits when creating a PR ?
If so, then the answer is yes:
- Using
git https://git-scm.com/docs/git-log#Documentation/git-log.txt---no-merges
See following code for an example of a bash function checking if there are any changes in a specific folder (in this example HEAD_TO_COMPARE_WITH should be set to the latest hash of the remote branch and local_sha to the local branch hash):
# To call this function `has_changes_to_be_pushed $project_folder`
# Returns 0 (success) if the given folder was modified (comparing with origin/master).
# @param The path of the folder to check for changes.
has_changes_to_be_pushed() {
local path_to_check=$1
# Prints the changeset (filename only) between your local branch and $HEAD_TO_COMPARE_WITH.
# Filters the changeset on the 'path_to_check' argument and counts the results.
# See https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203 for filter details
count=$(git log --pretty=format: --no-merges --first-parent --name-only --diff-filter=ACMRT $HEAD_TO_COMPARE_WITH...$local_sha | grep --invert-match '^$' | sort | uniq | grep "^$path_to_check" | wc -l)
# Returns success if changes were found.
(( $count > 0 )) && echo "" && echo " - Found changes in $1" && echo "" && return 0
# Returns failure if no changes were found.
return 1
}
- Using
github API https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files
Although I didn't test it, I'm pretty sure Github automatically hides merges when comparing 2 commits (at least in PRs it has this behaviour).
From the
README.md:I'm not sure I'm understanding correctly the problem, are you asking if there is a way to filter out merge commits when creating a PR ?
If so, then the answer is yes:
githttps://git-scm.com/docs/git-log#Documentation/git-log.txt---no-mergesSee following code for an example of a bash function checking if there are any changes in a specific folder (in this example
HEAD_TO_COMPARE_WITHshould be set to the latest hash of the remote branch andlocal_shato the local branch hash):githubAPI https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-filesAlthough I didn't test it, I'm pretty sure Github automatically hides merges when comparing 2 commits (at least in PRs it has this behaviour).