b4tch
b4tch

Reputation: 1198

Updating branch from another branch, then updating master

Firstly, please let me say that I am well aware that our setup is not "correct" or ideal, but this is how it has been done. I currently have...

  1. My development machine, which has a branch (either dev or redesign) checked out in one folder.
  2. On the same development machine, a folder containing the master branch
  3. A git server on our local network
  4. A web server running the master branch

When developing, I usually make changes in the dev branch, then when happy, merge them into the master locally, then push to our local git server and pull from that on our web server.

We then decided to overhaul the interface of our application, so created the redesign branch from the current dev branch. Since then, a whole host of changes have been made in the redesign branch and now I need that branch to essentially become the master. The dev branch can be overwritten with everything in redesign, but it would be ideal to keep the commit history for it if possible.

Being a somewhat inexperienced git user, please can somebody tell me the best process/commands to do this? I am thinking I need to "simply" merge my changes from redesign into dev, then do as I usually do, merging dev into master etc. I usually use Sourcetree, but can use CLI if easier.

Thanks!

Upvotes: -1

Views: 42

Answers (1)

larsks
larsks

Reputation: 312263

I'm not familiar with sourcetree, so I can't address that part of your question, but using git that procedure would be:

# switch to the dev branch
git checkout dev

# merge in the changes from the redesign branch
git merge redesign

# switch to the master branch
git checkout master

# merge in the changes from the dev branch, which at this point
# include the changes from the redesign branch
git merge dev

Upvotes: 1

Related Questions