Hacker News new | past | comments | ask | show | jobs | submit login

I worry about naming a function undo that doesn't necessarily undo what the user expects. Undo has a strong user expectation, and I'm not convinced this matches that.



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.


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.


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


You are absolutely right and I'm sorry to see you getting downvoted. See:

http://bryan-murdock.blogspot.com/2013/06/git-branches-are-n...


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.


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.


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.


What do you think `git branch` should do?


It creates a branch of zero length.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: