What are the dangers of accepting a branch merge with Behind commits?

Asked

Viewed 470 times

5

Sometimes when I make one merge request in a project, it appears that there are commits Behind, I understand that, this happens due to the fact that at the time of creating my branch, based on the branch where I will create the merge request then there were no commits which were created after, and in which I ended up not updating my branch current.

What I tried to illustrate is the following scenario:

inserir a descrição da imagem aqui

My question is, what are the dangers of accepting the merge of my branch even if there is commits Behind?

Sometimes these 'Behind commits' are in other files than the ones I changed, so much so that it doesn’t conflict when creating the merge request

If I merge, even if the codes of commit Behind do not affect the code I have touched, I run the risk of rewriting the codes that were created in commit Behind?

  • From what I understand from your explanation, this is the most common scenario in the versioning world, there is no problem, if there is no conflict, just merge, there is no need to synchronize the branch.

2 answers

3


It’s good practice to pull from the parent branch you want to open the merge request from. In this case, "Master".

In theory there is no problem you open a merge request if there is no conflict, but if there is, git won’t do the automatic merge and you’ll need to do the manual merge solving conflicts.

However, one problem that may occur is that your code may not work properly with the additions made in Master, and then you will only know after the merge. If the merge occurs automatically, it will be more difficult to detect the problem.

Therefore, it is always recommended that you pull and test the changes before ordering the merge. So you ensure that your addition to the code will not break anything, and nothing in the code that is in Master will break what you did.

1

My question is, what are the dangers of accepting the merge of mine branch even if there are Behind commits?

The only problem would be if there was conflict between code and you need to fix manually, remember, testing in the end is always necessary.

In practice you should have the branch develop and in it you merge all the other branchs and only then merge in the master (This is the end result of the cycle and there can be no errors or conflicts).

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.