6bytes
6bytes

Reputation: 6132

Committing to git and local folder structure

I have a project written in Laravel 4. Everything goes to "master" branch in Bitbucket. I'm migrating my app to Laravel 5 and I'd like to keep both versions in my git repo as separate branches.
My local folder structure looks like this:

Project - this is my main git repo folder
    ˪name - Laravel 4 code is here, all in git already, on "master" branch
    ˪name5 - Laravel 5 code is here, not in git yet. Should go to a separate branch

How do I go about achieving that?

Upvotes: 0

Views: 570

Answers (1)

Akram Fares
Akram Fares

Reputation: 1683

What you want to do is to commit all the current changes on name to your master branch. Then create an empty branch in the same folder, let's say develop, and move name5 to name.

Finally, commit/push your changes to this new branch.

  1. Commit/push you current changes (easy to do)
  2. Create an empty branch in the same folder: git checkout --orphan develop
  3. Clear the working directory: git rm --cached -r .
  4. Move the content of name5 to name (without removing name/.git/ folder)
  5. Commit/push your changes to the new branch.

Upvotes: 1

Related Questions