Janis Lesinskis' Blog

Assorted ramblings

  • All entries
  • About me
  • Projects
  • Economics
  • Misc
  • Software-engineering
  • Sports

Renaming Git branches


Originally posted here: https://www.scrygroup.com/tutorial/2018-05-24/rename-git-branch/

I've spent a few days in a cold office And one thing I notice is that I'm making a lot more typo's when it's cold.

One particularly cold day (it was 13 degrees inside) I was working away on fixing some bugs in a branch on Git. I ended up solving the issue and wrote a test case that covered it in case there was a future regression. As I was about to push the changes I noticed a spelling mistake in the Git branch name.

git push origin bugifx-serialization

While I could have just pushed this up and merged it I really don't like pushing branch names with typo's. There's a level of attention to detail that's really crucial with software development work and things like this bother me. (for example if you had a script that matched on various branch name prefixes like "bugfix", "feature", etc. this would not match)

Because I haven't pushed changes there's a really quick fix for this:

git branch -m bugifx-serialization bugfix-serialization

Done!

In this case the -m is short for --move, like the mv command in the shell enables you to rename files by "moving" them this allows you to rename branches.

Published: Thu 24 May 2018
By Janis Lesinskis
In Software-engineering
Tags: Git

links

  • JaggedVerge

social

  • My GitHub page
  • LinkedIn

Proudly powered by Pelican, which takes great advantage of Python.