So I mainly use Mercurial for my projects and I decided to sit down and learn all Git's shenanigans to discover if I'm in the right side (at least for me).

I'm learning that git uses namespaces for branches and I would like to know (in your experience) what is the point of namespaces?. In Mercurial I could just set the convention of naming branches like so:

<branch name> //for "origin" branches
<username>/<branch name> //for user branches

I imagine that there is more to it than just the name (aside from avoiding naming conflicts), but what do I get out of this seemingly more complicated (not necessarily bad) model?


Git doesn't "use" namespaces in the sense like they are required. It offers the completely optional ability for a user to use namespaces if they want them. You can use the exact same naming convention as you did in mercurial if you want, and I imagine that's what the vast majority of people do.

What namespaces buy you is the ability to combine multiple repositories into one, but be able to only show branches from the one virtual repository. Within the namespace, you can still name the branches using whatever method you prefer. Personally, I don't really see the benefit over just using multiple repositories, but obviously someone thought it might be useful sometimes.

Git has a ton of features, of which maybe 3-5% see daily usage by the typical developer. The trick to getting along with git, is for those features you don't want/like/understand, don't worry about them.


Never done something serious with mercurial, so I can miss something. I'm using namespaces in git branch naming pretty much, but I'm never inserting my name into the name of the branch.

For each task that are describe in task tracker we are creating a separate branch, with number of the ticket and short description of the bug. At this point there are no spaces yet:


Then, say, you realize that some task need additional branches for experimenting. These branches are de-facto children to "main" task branch, i.e. after completion the should (if should at all) be merged to that very task. Here come namespaces:


I've seen that slash is also used for namespacing, but personally I prefer dots, since using slashes can produce some issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.