You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.