Switching git branch names

Recently I was working on a project where there’s only the master initially, which uses docker for the environment.

Afterwards, as the project is ready to be launched, I made another branch named basic_setup which does not use docker anymore, but just uses the preset environment in the production server instead.

Then I think it would make more sense if I switch the branch names; the original master branch should be named development branch, and renaming basic_setup to master. So that whenever there are new changes I can always just work on the development branch using docker in my local environment which is definitely easier.

Here is the guide I followed and worked well for me in this use case:

https://multiplestates.wordpress.com/2015/02/05/rename-a-local-and-remote-branch-in-git/

IMPORTANT

But there is one tricky part if you are using gitlab or github where there is a default branch setting that forbids you from removing it in the remote repository. So you have to switch that default branch to something else before you can remove it.

Published by Mageek

Just another geek in the world

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: