1

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?

4
  • Why merge? Why not rename master (i.e. to old-master) then rename your v2 to master when you're ready?
    – beatgammit
    Jul 16, 2013 at 4:59
  • I could do that? Hrmn... or I could do that as well. But within the two solutions... what is their difference or implications?
    – index
    Jul 16, 2013 at 5:04
  • Main difference is you lose commit history, but it seems like you don't care about that. Any reason why you don't just want to update your current project to Rails 4? Seems the commit history may be valuable...
    – beatgammit
    Jul 16, 2013 at 5:08
  • I see. Well, I would leave the master branch so I'd still have that history but well, just in a separate project I guess. My reason why is that 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. Also, my project is going on a kinda different route but I know I'll be using some of my codes from old project so I can't just remove it.
    – index
    Jul 16, 2013 at 5:15

1 Answer 1

1

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".

3
  • Well, I have limited private repos that's why I opted to take this solution. So it's only the history that's the main difference with them? I was thinking also about the solution of @tjameson regarding "merge to master" where he says it's better to just rename master to old-master and then v2 to master.
    – index
    Jul 16, 2013 at 7:13
  • @index if you are the only one cloning this repo, then yes, renaming master is the simplest solution. Otherwise, having a parallel branch, and merging onto master when ready is one usual solution.
    – VonC
    Jul 16, 2013 at 7:16
  • I got others as well but it's a close team so we can just inform each other when we start moving/renaming the branch names. Hrmn... But just in case, we still have your solution.
    – index
    Jul 16, 2013 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.