My first experience with a distributed SCM systems was Mercurial. Running hg branch
created a new branch and automatically switched you over to it.
When I moved to Git, I occasionally fell into the trap of typing git branch
and expecting to change over to the new branch. I fell for this quite often for a long time, for several years at least. It was happening frequently enough that I actually hacked Git to tell me that I haven’t actually changed branches yet:
$ git branch xyz-123
Branch 'xyz-123' created, but you're still on 'develop'
I’m using OhMyZSH now, which shows the current branch in the prompt. This has helped a great deal, and I fall for this much less often than I used to.
And yes, I know about git checkout -b
, but typing checkout
to create branches was a bigger change to me than simply learning that git branch
doesn’t change branches.