Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can my Dev branch ever get behind my Master branch?

Loris Gifts
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 7, 2024

I have two main branches; Dev and Master. New branches are only created from the Dev branch, and are merged into the Dev branch. Eventually Dev is merged into Master. Branches are never created from Master. Frequently, I get notice that my Dev branch is behind Master by X commits and to sync. How can Dev ever get behind Master, if my dev team never creates branches from Master, or merges into master? I've asked my dev team and confirmed that they do not branch from Master or merge into Master.

1 answer

1 accepted

3 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 10, 2024

Hi @Loris Gifts and welcome to the community!

If the Dev branch is behind Master, this means that there are one or multiple commits on the Master branch that are not reachable by the tip of the Dev branch. The message has nothing to do with the diff between the two branches, it only has to do with commits being reachable.

If commits are not pushed to Master branch directly, this can happen when you merge a PR from Dev to Master with merge commit or squash merge. The merge commit or the squashed commit will be added to Master branch when you merge, but that commit will not be reachable by the tip of Dev branch.

Assume the following commit graph, with A, B, C, and D representing commits. A and B are commits on the Master branch, while C and D are commits on the Dev branch.

         C - D      <-- Dev branch
/
A - B - <-- Master branch


If you merge Dev into Master with a merge commit, the graph will look as follows:

      C - - D        <-- Dev branch
/ \
A - B - - - - E <-- Master branch

Master will point to commit E, the merge commit, while Dev branch is still pointing at commit D. Commit E is not reachable by Dev branch, so in this case the Dev branch will be 1 commit behind Master.

I hope this helps, please feel free to reach oout if you have any questions.

Kind regards,
Theodora

Loris Gifts
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 10, 2024

Much more complex than I understood. Thank you.

Like Ted Long likes this
Ted Long
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!
October 22, 2024

Hi Loris.
I encountered the similar issue.
It says that dev branch is 3 commits behind the main branch and I cannot merge.
How can I resolve this issue?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2024

Hi Ted,

There may be branch restrictions on the repo that restrict which users can push to certain branches and/or merge PRs on certain branches. There might also be an enforced merge check "Maximum number of commits behind destination branch", that prevents you from merging.

If you have admin access to the repo, you can check that from Repository settings > Branch restrictions. Otherwise, you'll need to ask a repo admin to check.

If this is not the case, please create a new question in community providing more details (e.g. error messages) and we will look into it. You can create a new community question for Bitbcuket via this link:

https://community.atlassian.com/t5/forums/postpage/board-id/bitbucket-questions

Kind regards,
Theodora

Ted Long
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!
October 22, 2024

Thank you so much, Theodora.

Should repo admin resolve this issue via command line on local, right?

Or is there any other methods in the software engineering standard?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events