1

When working on a home project, I decided to keep one common git repository for two close areas of the project: hello and world, each being developed in its own directory:

$ ls -la
.git hello world

I now realize that this was a mistake and that I should have split it into two repositories, one in each directory.

Best case scenario: is there a mechanism which splits a repository in two, moving the changes relevant to files in hello and in world to their respective repositories (one in hello and one in world)

Less good case scenario: I care somehow less about the history in world so is there a way to move the whole repository into hello (it would also cover changes in world but never mind) so that I can restart a fresh repo in world?

Even less good case scenario (but who know): I will restart the repos from scratch and call it a lesson learned in thinking ahead more than I thought I should.

WoJ
  • 27,165
  • 48
  • 180
  • 345
  • Yup, with filter-branch and a combination of `--prune-empty` and `--subdirectory-filter` - see https://help.github.com/articles/splitting-a-subfolder-out-into-a-new-repository/ – 1615903 Feb 08 '19 at 12:01
  • Check this link https://stackoverflow.com/questions/359424/detach-move-subdirectory-into-separate-git-repository – FrancJnr Feb 08 '19 at 12:08
  • 1
    @1615903: thanks, the other comment points to an exact duplicate which I will mark as such – WoJ Feb 08 '19 at 12:26
  • 1
    @FrancJnr: thanks! this is a duplicate I will mark as such – WoJ Feb 08 '19 at 12:26

0 Answers0