← Back to context

Comment by zellyn

7 years ago

Is it just me or did http://ohshitgit.com/#accidental-commit-master forget to checkout master before calling reset?

Creating a branch doesn't check it out by default. To do both at once, it's either "checkout -b" or "branch -c", I forget which because it's "b c" in Magit.

It's still on master because `git branch` just creates and doesn't do checkout.

(Which is why I've almost exclusively switched to `git checkout -b <newbranch>` for creating. How often do I want to create but not switch to the branch?)

  • Git branch is helpful if you just want to make a snapshot before doing something potentially harmful. If you hose up, just checkout that branch again.