index
index

Reputation: 3727

Git: How to create a new branch but somewhat different project

I am going to update my Rails3 project to 4 and at the same time have a clean start project all together. So my solution is to create a new rails4 project and just transfer one by one, what I need in my previous project.

I was thinking of creating a new branch for my new rails4 project and eventually when I'm done is transfer it back to master and override it. I have come up with two solutions but I don't know what both implications would be. Which should I implement?

  1. Just create a new branch git checkout -b v2 and do a git rm -rf on the project. Start my new rails app and commit or
  2. Use --orphan? I just recently found this option in git. So I'd use git checkout --orphan v2 do also a git rm -rf on the project and start my new rails app and commit.

Basically they look almost the same but I was wondering like what would happen if I tried to merge them back to master or override master already?

Upvotes: 1

Views: 581

Answers (1)

VonC
VonC

Reputation: 1324043

my old project already has a lot of clutter and unused codes and I don't want to do the new one on top of those already. So instead of remove what I don't need, I opted of moving what I need

One solution would simply to manage a different repo, if having the history isn't that important.

Or, if you must keep one repo, go with option 2/ (orphan branch)

If the merge to master with override is what worries you, I have summarized the different ways to achieve that in "git command for making one branch like another".

Upvotes: 1

Related Questions