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

What does the behind/ahead column mean in the branch view

Deleted user October 1, 2019

On 1 of the repo I work, one of the feature branch behind/ahead column says 41/36 (aka 36 ahead and 41 behind). The branch has been merged so I would assume the branch should be behind....

So my questions are:

-What does the behind/ahead column mean ?

- How a branch can be both behing and ahead of another branch ?

Thanks for your help

3 answers

2 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2019

Hi @[deleted],

Welcome to Atlassian Community.

What the the behind/ahead column is telling you that you have made changes on your branch that has not yet made it to the default branch (the branch Bitbucket is comparing against), meaning your branch is ahead. If there are changes on the default branch that has not yet made it into your branch, then it means your branch is behind the default branch. A branch can be both ahead and behind at the same time if you have made changes to your branch, and someone else have made changes on the default branch that you have not merged into your branch yet. 

Aquib Mir
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!
May 11, 2021

I have a branch with 6 commits, and it shows 4 commits behind master in Bitbucket Cloud. If I click Sync now, what will happen?

In my local repo, when I run git status, both master and branch are up to date with origin/master and origin/branch, respectively.

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2021

@Aquib Mir this should be its own question, and you could reference this on in it.

Anyways, when you click sync it will only sync your local branch to your remote branch. The 4 commits behind master just means that your branch is out of sync with the master, and you should do a merge from master to your branch in order to get the latest changes from master into your branch. When you do this merge depends, I have always recommended my users that do merges from master/dev to their branches often and early, that way you will avoid having to make major changes on your branch at the end.

David Cook August 19, 2021

Clear as mud!

Like David McBride likes this
karunt May 13, 2022

Still confused.  After I click sync on a particular branch (let's call it BranchA) from the Branch view, the Commits view shows "Merged master into BranchA".  This implies that the sync function is actually syncing up remote master with the remote BranchA.  But even after this, I see the remote BranchA ahead of master on the Branch view.

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 13, 2022

@karunt Syncing a branch is not equal to merge. Only a merge to the default branch will reset the ahead/behind count.

karunt May 13, 2022

From the Branches view, the Actions for the master branch don't give me a choice to merge with any other branch.  So how can I merge master into BranchA to make sure BranchA isn't ahead or behind master?

karunt May 13, 2022

Here's a screen shot, showing the options for master branch - no merge option available.

 

Screenshot (67).png

Ronaldo nazarea
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!
April 3, 2023

Hi Karunt, Bitbucket beginner here, but my understanding is the create 'Pull Request' concept is the Bitbucket way to get your branch changes merged to the master. 

1 vote
Rob Simpson
Contributor
June 23, 2020

The OP said "The branch has been merged" so I would think the branch should no longer be "Ahead" of the master branch. We have the same issue. The branch has already been merged but it says the branch is still multiple commits "Ahead" of the master branch. When I go to Create a Pull Request, it says "There are no changes. No commits on BranchName that aren't on master." and will not let me click on the "Create pull request" button.

tobiasbischof
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!
August 27, 2020

same problem here. 

E.g. I merge /develop into /master. After that, my develop branch is 1 behind master (expected) but still many commits ahead. Creating a new PR from /develop to /master shows me all previous changes again in the description although no files are changed.. 

Like # people like this
0 votes
ScottS
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!
January 19, 2023
karunt January 19, 2023

Appreciate the link, but it doesn't address the fact that I don't see a merge option (please see the attached screenshot).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events