Reputation: 18148
I have two branches say master and dev.
Master is old and I want to put dev into master so effectively:
I can do this in the following way:
But I am wondering what is the correct way to do this in git?
Upvotes: 0
Views: 300
Reputation: 76837
This is pretty simple to solve - use branch rename to rename the existing master branch, and then checkout a new branch named master
from the dev
branch
git checkout dev
git branch -m "master" "master_old" #rename existing master branch
git checkout -b master #recreate master from dev
Additionally, push your new master branch upstream using
git push upstream -f master
If now you do a git branch
, you will see
$) git branch
dev
* master
master_old
Upvotes: 1