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

What are branches in BitBucket and how to manage them

Zsolt Ero December 30, 2012

I have the following problem. I have a repo, which I originally cloned from github using hg-git, but since I've been developing on it in mercurial. The original dev also keeps updating the repo, so we have multiple heads and I merge whatever I want using TortoiseHg, it works really well (I think hg-git doesn't make a difference here). However I have the following problem: now I've pushed my version to BitBucket, and it has three branches.

3 default

I'm totally confused with this. Shouldn't a branch in git be a bookmark in Hg? Then why does BitBucket support branches and not bookmarks? I really don't get what is a branch in Hg and why do I have 3, when actually hg branch only lists one: default? Or they are actually not branches, but bookmarks, just BitBucket named them like this not to confuse git users? But this is a Hg repo (set to be Hg when I created initially), and I'm not using git!

When I try hg heads -q I get the exact same result:

235:03d08bcf3144 233:d7fbd581b9e1 227:abda0dc38b93 

So is it actually a head what BitBucket calles a branch? Is so, how can I name them like branches in Git, like default, forked-from, etc.?

One idea I had in mind was to create a bookmark at each head. I figured out how to push -B each of them to BitBucket. Now it looks like this:

6 branch

So now it starts to make sense, but what can I do with the 3 defaults? Why are they there and what are they actually? Branches, heads or bookmarks in Hg?

And why do I have only one in BitBucket settings?

1 in settings

3 answers

1 accepted

1 vote
Answer accepted
Zsolt Ero January 7, 2013

In the meanwhile I finally understood it. It's about branching in mercurial using named branches or bookmarks. It has nothing to do with hg-git.

Look at this guide from Steve Losh:
http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

The problem is that the BitBucket UI only supports the concept written in that guide as "Branching with Named Branches".

The problem is that I'm trying to use the concept "Branching with Bookmarks". It is a very common concept, and lot of people are using it, but BitBucket's UI is not compatible with this.

I'd like to ask the following solution to this problem as a feature request:
- Detect if the repro is using the "Branching with Bookmarks" concept
- modify the list of offered branches
in the UI adequately

Technically it's very simple:
IF the repro has multiple heads, AND all heads are named 'default',
then: don't offer branches all named 'default', but offer the list of bookmarks as the possible list of branches.

Alternatively, make this switchable in the UI, instead of automatic detection. It should be called something like:
Used branching method: - "named branches"
- "bookmarks"

With a reference to the Steve Losh guide or some wiki compiled from it.

0 votes
Nicolas Venegas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2013

You have three distinct heads on the default branch, as reported by the "hg heads" command. Git does not have the concept of more than one head on a branch.

You also have created three bookmarks (git-ks, git-max, master).

Since hg bookmarks behave in a similar way to git branches, in Bitbucket we sometimes treat them like a branch (which is why you see them listed in the "Branches" tab of the branch selector). It is perhaps not always correct to treat bookmarks like branches, and we may not be entirely consistent about when we do treat them as a branch.

You asked:

Shouldn't a branch in git be a bookmark in Hg?

I suspect that depends on the behaviour of hg-git. It seems that it is converting those git branches into hg branches.

Zsolt Ero January 2, 2013

In the meanwhile I finally understood it. It's about branching in mercurial using named branches or bookmarks. It has nothing to do with hg-git.

Look at this guide from Steve Losh:
http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

The problem is that the BitBucket UI only supports the concept written in that guide as "Branching with Named Branches".

The problem is that I'm trying to use the concept "Branching with Bookmarks". It is a very common concept, and lot of people are using it, but BitBucket's UI is not compatible with this.

I'd like to ask the following solution to this problem as a feature request:
- Detect if the repro is using the "Branching with Bookmarks" concept
- modify the list of offered branches
in the UI adequately

Technically it's very simple:
IF the repro has multiple heads, AND all heads are named 'default',
then: don't offer branches all named 'default', but offer the list of bookmarks as the possible list of branches.

Alternatively, make this switchable in the UI, instead of automatic detection. It should be called something like:
Used branching method: - "named branches"
- "bookmarks"

With a reference to the Steve Losh guide or some wiki compiled from it.

0 votes
Felipe Kraemer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 30, 2012

Hello,

In this document below you can see what branches are used for and how to use them:

https://confluence.atlassian.com/display/BITBUCKET/Branching+a+Repository

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events