There are currently three brenches in my project.
- main
- stag
- hotfix
and different Jenkinsfile in main and stag branch.
For your information, I use Jenkins’ multibranch pipeline.
When making a pull request from the stag branch to the main branch, the Jenkins file of the stag branch is also included in the merge.
This is the problem.
This is because the commit that modified Jenkinsfile is also included in the pull request.
But I don’t want Jenkinsfile to merge.
If I continue to make any modifications to stag branch Jenkinsfile, I have to go through this process every time.
Can I exclude the changes to a specific file from the merge pull request?
Tried
I have tried to exclude using the .gitattribute file.
.gitattributes
Jenkinsfile merge=ours
git config --list
...
merge.ours.driver=true
...
The pull request merge included Jenkinsfile despite adding a .gitattributes file.
git rebase
When the commit is excluded through rebase, the reflection of the commit is also excluded from the repository.
The commit that modified Jenkinsfile is located at the top.