views:

2427

answers:

5

What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches?

+14  A: 

It's not a technical term; it just refers to a branch that was created to implement a specific feature or fix a bug. The "topic" is the reason for the creation of the branch, essentially.

mipadi
yep. as opposed to a personal branch, where you have branches: bob, alice, mat, etc.
webmat
+8  A: 

Topic branches are typically lightweight branches that you create locally and that have a name that is meaningful for you. They are where you might do work for a bug fix or feature (they're also called feature branches) that is expected to take some time to complete.

Another type of branch is the "remote branch" or "remote-tracking branch". This type of branch follows the development of somebody else's work and is stored in your own repository. You periodically update this branch (using git fetch) to track what is happening elsewhere. When you are ready to catch up with everybody else's changes, you would use git pull to both fetch and merge.

I have also seen another kind of branch which is essentially a completely separate tree of files in the same repository. For example, the Git repository itself contains heads named man and html that contain entirely different content from the master branch. I don't know what these types of branches are usually called.

Greg Hewgill
I was looking for how to have two branches without common a ancestor commit and found this: http://madduck.net/blog/2007.07.11:creating-a-git-branch-without-ancestry/
Nicolas Marchildon
A: 

Okay, so from what I'm reading here it looks like the most prominent and important type of branches that aren't topic branches would be release branches on a major, publicly-available repository, right?

skiphoppy
A: 

it looks like the most prominent and important type of branches that aren't topic branches would be release branches on a major, publicly-available repository, right?

That's probably right for you, but that's about you and the project you're thinking about; it's not determined by Git.

Most version control systems (particularly centralized ones) prescribe or enforce a particular workflow, including what it makes sense to use a branch for. Git ( and to some extent most distributed VCSs) consider that workflow, what branches are used for, when to commit, what different repos are used for, etc. is all chosen by the users and agreements among the users (policies). So Git doesn't enforce these technically.

This is one of the things that made Git hard for me to learn. Oliver Steele explained this from user's view, writing about Commit Policies.

Paul
A: 

*> For example, the Git repository itself

contains heads named man and html that contain entirely different content from the master branch. I don't know what these types of branches are usually called.*

They are called subtrees

Eric des Courtis