skube
skube

Reputation: 6175

Is there anything special about Git feature branches?

I'm trying to understand feature branches in git. My understanding is that the term feature branch is simply a naming convention or methodology to help conceptualize and organize when add new code.

Specifically, my understanding is:

Am I failing to grasp something fundamental?

Upvotes: 0

Views: 1461

Answers (2)

Mark Adelsberger
Mark Adelsberger

Reputation: 45739

Beyond what's written, I would add one thing: You mention that a "branch name" starting with origin/ is special; but this isn't exactly right.

origin/master is not a branch with a special name. The origin/master you typically see is actually refs/remotes/origin/master - a remote branch reference, which is a different thing from a branch. (A branch is a type of ref, and so with the similar words flying around it's a little confusing. But a branch is a ref that, by default, moves when you commit while it's checked out. A remote branch ref is a ref that, by default, moves as needed during communication with the corresponding remote.)

(If you had a branch named origin/master, that would be refs/heads/origin/master, and in that case the origin/ prefix would be meaningless, just like any other. But a word of advice: don't do that. It'll only lead to confusion.)

Upvotes: 0

AJ X.
AJ X.

Reputation: 2770

The use of git "feature" branches is more about communicating in a consistent way when working with a team of developers.

Two common branching strategies that make use of feature branches are GitFlow and Trunk. You can dig in to them a bit and see how they may be helpful to your development workflow.

As @CoryKramer mentioned, prefixing branches with a standard prefix (ie. Feature, Hotfix, Release, etc) is most helpful for automating your development process with continuous integration tools like Jenkins, Bamboo, CircleCI, TravisCI, etc. A common practice is to spawn builds for specific feature branches and prevent merging to master until the feature has successfully built, been code reviewed, and has proper test coverage.

Upvotes: 2

Related Questions