top | item 12358149

(no title)

Mchl | 9 years ago

Git already has `git branch` which doesn't in fact do any kind of branching but creates a label which follows commits when it's checked out.

discuss

order

panic|9 years ago

Git also has 'git revert' which creates a new commit, 'git reset' which actually reverts (among other things), 'git checkout' which switches branches... the fact that all the other commands are confusing doesn't mean this new one has to be.

OJFord|9 years ago

That's all a Git branch is though; so it makes perfect sense for the command `git branch` to do that.

phaemon|9 years ago

It doesn't immediately make any kind of branch, but if you then create commits using both of the labels it will inevitably create a branch in the DAG so it's not terribly misnamed.

nf05papsjfVbc|9 years ago

You can look at it as a copy-on-write optimisation. It may not be so poorly named if you look at it that way.

parenthephobia|9 years ago

I think git branch only doesn't "branch" if you already have a differing idea of what a "branch" should be from another revision control system.

For example, I consider that CSV and Subversion don't have branches, but just "copies". To my mind, what git branch does is exactly what branching is.

WillAbides|9 years ago

What do you think `git branch` should do?

ISL|9 years ago

It creates a branch of zero length.