Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git make remote master point to another branch

Tags:

We got a 'dev' branch thats been functioning as de-facto master for quite a while.

Is there a way to make my remote/master just point to the same place as remote/dev ? (no merging / rebasing / extra work).

(More or less a rename of dev to master)

Thanks in advance

like image 795
Boris Avatar asked Jan 15 '11 11:01

Boris


People also ask

How do I point a master branch to another branch?

Checkout master branch, reset it to dev, push. This will affect users downstream who may have branches off your remote/master. This will cause you to lose any commits you have made since your remote and dev diverged, but you will end up with the same state as remote/dev.


1 Answers

Checkout master branch, reset it to dev, push. This will affect users downstream who may have branches off your remote/master.

git checkout master

git reset --hard remote/dev

git push -f

This will cause you to lose any commits you have made since your remote and dev diverged, but you will end up with the same state as remote/dev.

like image 54
RJFalconer Avatar answered Nov 15 '22 20:11

RJFalconer