Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,473
Community Members
 
Community Events
165
Community Groups

I am wondering what are the best practices for resolving merge conflicts. in my particular case I want to basically overwrite the destination branch with the files of my development branch. However, I am not able to do so because of merge conflict. basically there was another commit on the destination branch and that file is different that the baseline used in my development branch. I understand the reason why the merge conflict is highlighted but in this particular case I just want to overwrite that file with the one from my development branch without having to do any local changes. is there any way to achieve this?

2 comments

Mikael Sandberg Community Leader Oct 26, 2021

Best practices for merge conflicts is to update your local copy of the destination branch, merge it with your development branch, and then push your development branch back to Bitbucket. By doing this you can decide to overwrite everything on the destination branch with your changes.

Like Christian Avila likes this

thanks this is very helpful!

Some teams may have a policy in place where pushing code to important branches like `develop`, `release` or `master` are not permitted.

In this case you 

 

git checkout feature/branch

git fetch origin develop

git merge FETCH_HEAD

 

And follow @Mikael Sandberg advice above. Most IDEs support resolving merge conflicts through their GUI where you can choose which code segment to accept.

Once you have resolved conflicts (and perhaps quickly built your code) run

 

git commit

 

which will conclude the merge.

Then push your feature branch to bitbucket (remote) and create a formal pull request from feature/branch to develop  for your team to approve and merge, so all changes are consolidated in your target (develop) branch.

Let me know how you go, happy to help.

Best, Ulrich

Izymes

Like # people like this

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,095 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you