How to create a new git branch from a messy working copy?

49 views Asked by At

I'm working on a project that has just a single master branch and there are two servers, a testing one with an up-to-date working copy, and a production one whose working-copy is behind.

I'd like to have the production and testing each have their own branches (with production server using the master branch). The difficulty is that the production working copy has some files more updated than others, e.g. when critical bug fixes were fixed, just single files were brought up to date.

How do you go about creating a new branch from the production working-copy even though it's files are at different points from the masters history?

1

There are 1 answers

1
locoboy On

The copy in production should always be your master. Branches on staging can be ahead in some ways and you should git pull [remote] master before ever submitting a pull request into master with your new branch on staging.