views:

104

answers:

1

I'm working on a project with some people who have never used git before. Not knowing the capabilities of git, they created two version of the project: development and production. These two versions are both present in the current environment.

To complicate things further, this other user created these folders in addition to the old development folder. So the project directory looks like this

/root
  /.git
  /proj         (old dev folder with my own code in it)
  /dev_proj     (new folder which I would like to merge /prod with)
  /prod_proj       (production code)

So what I'd like to do is merge the work that I've done in /proj with the work in the /dev_proj. Is there a way to do this with git?

I've thought about creating a branch, copying all the files from /proj to /dev_proj and merging that branch with master. Would this work?

Thanks and if I could clarify something let me know.

A: 

I'm not a git expert, but I would suggest making a new branch, rooted at the change where he copied his code from before making the changes.

git branch devProjTemp <commit-id>

(Don't forget to git checkout devProjTemp.) Then copy all the files from dev_proj to proj, and commit. Then you should be able to merge from the new branch to master and it should do the right thing.

If you want to have separate dev and prod data, I would also suggest creating a branch for one of them. Specifically, I would create a prod branch and copy the changes from prod_proj over to that.

Then, I would delete prod_proj and dev_proj in the master branch and the prod branch.

Does your coworker not know about branches? I would do some teaching there. It shouldn't be so hard once you've created the branches.

clahey