Hello Everyone,
I am facing this issue where when i merge my code from dev to stage pipeline , I get a merge conflict error on bitbucket-pipelines.yml and config.js.
It is a requirement that these two files stay different in both pipelines as they contain configurations specific to them.
I have tried adding .gitignore file with entry of yml file and config.js directly into the repo through UI but that doesn't seem to help
I also tried applying .gitattributes by following this answer on stackoverflow: gitattributes
but i still get the merge conflict.
Any help would be much appreciated.
Thanks in advanced!
Hi, @Mukul Rana, welcome to the community!
Before we start, I would like to further understand the configuration you have in your repository. Do you have 2 yml files under this repo? Also, when you say that you are facing an issue when you merge your code from dev to stage pipeline, is it triggering a default definition in your pipelines?
If that’s the case, you can actually have 1 YAML file under your repository and configure it to run specific sections for specific branches, this way, the names or expressions in this section are matched against branches in your Git repository. For example:
pipelines:
default:
- step:
name: 'Build and Test'
script:
- echo "Your build and test goes here..."
branches: #these will run on every push of the branch
bug:
- step:
script:
- echo "I'm testing something here"
This document explains how to configure your bitbucket-pipelines.yml, in case you would like to take a look:
Looking forward to hearing from you.
Kind regards,
Caroline
Thanks Caroline
We were able to solve this issue by rewriting our yml files in the way you suggested!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I missed an important part of the question.
With the help of your suggestion, i was able to reorganise my yml files and avoid merge conflict however my config.js file still shows merge conflict error.
Let me tell you more about our current scenario
We have a config.js in our stage pipeline and in production. It is necessary that these two files remain different. However, when we merge stage to production, we get a merge conflict on this file.
Can you suggest a way by which when i merge these files remain in thier original state or if i can say - Are ignored while merging.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Mukul Rana,
This is not possible as Git does not allow this. However, while searching for workarounds, I found the same questions on other sites that might help you:
https://stackoverflow.com/questions/15232000/git-ignore-files-during-merge
https://stackoverflow.com/questions/38044166/how-to-exclude-files-from-merging
They recommend running git merge with the flag --no-commit
to avoid specific files.
I hope this helps, but let me know if you have questions.
Kind regards,
Caroline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.