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.

Suggest an answer

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

Atlassian Community Events