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
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@karunt Syncing a branch is not equal to merge. Only a merge to the default branch will reset the ahead/behind count.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.