Get the name of changed files in MR
Jul 22, 2024/
#git
/-1 minIn companies with unestablished pipeline systems, there is always a risk of incidents with config changes. The short term solution is to analyze the changed files to prevent them from being sent along with the code.
You can use
git diff
to get a list of changed files in a practical way.
1git diff --name-only ${SHA}
Notes
- You can use Gitlab's predefined
variable to find changed files in MR pipelines.CI_MERGE_REQUEST_DIFF_BASE_SHA
- If you are only interested in the names of the files, you can switch to the
flag.--name-only