Will merging two PRs overwrite each other?

Claudiu Argeseanu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 17, 2023

my colleague and I are working on updating the same code file, using separate branches.

We initially branched from master at the same point (say commit A) , and created PRs at the same time.

Now, my colleague managed to merge first to master, bringing the code file to commit B.

My question is what happens if I merge my PR to master?

- will my PR overwrite his work, resulting in commit A + my work?

- will my PR add to his already merged work resulting in commit B + my work?

I should specify that no CONFLICT is displayed on my PR after his merge. I guess that happens because we worked on separate parts of the file:

- he modified rows 100 to 150

- I added new rows 400 to 500 to the file

Should I merge master (commit B) in my branch and then merge my branch to master to be sure nothing gets overwritten?

 

1 answer

1 vote
Ulrich Kuhnhardt _IzymesCo_
Atlassian Partner
June 18, 2023

Hi @Claudiu Argeseanu - welcome to the community.

You can rest assured that Bitbucket or git for that matter will not override changes already merged. Hence it is called a merge and not a write.

Each merge is an atomic operation. Even if you were to write (push) to master git/bitbucket won't let you (unless you use the --force push option).

Hope the helps.

Best, Ulrich 

// Izymes

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events