0

I've inherited a Git repo that has one directory and about 20 branches in it. Each branch contains totally unique code - something with it's own make and source that would normally (if I set it up) be in separate subdirs. It's very tough for me to work with as is.

How can I break up these 20+ branches into 20 directories, keeping the histories intact of each branch and establish a more traditional Git layout.

1 Answer 1

1

You should:

  • create a temp folder
  • create folders for each branch in your temp folder
  • copy all contents of each branch in each folder
  • remove the contents in your branch master of your git repository if I understand what you want
  • move all contents of temp folder in your git repository

you can automate the process with a shell code thanks to git branch -a

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I assume that each new directory will have the branch from the old repo after the cp operation. Do I just checkout a new branch, say MASTER, from each directory, and merge it in from the old branch, and go from there?
@user2945953 if you want to restart on clean base I suggest you to delete the others branch

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.