-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 27/05, Chris Walker wrote:
I have a git repo called https://github.com/tonercloud/beertent and which contains two projects, harbour-beertent and harbour-beerguide. But I want to split out harbour-beerguide into a separate repository and also if possible move harbour-beertent up a level so that beertent is empty and just leave that repo as harbour-beertent.
Hi Chris,
While you could do it this way by filtering out the content you don't want, you're likely to be left with commits that won't make sense and neither resultant repository will have shared history with the original repository.
Additionally, the commit histories won't show what's really happened and I'm a firm believer that they should :) git blame is wonderful ;)
So, what I'd recommend is simply something like:
$ git clone beertent beerguide
To create a new copy of the entire repo, then...
$ cd beertent $ git rm -r harbour-beerguide $ git mv harbour-beerternst/* ./ $ git commit -m "Remove beerguide and put beertent at the root"
To remove the beerguide folder from the beertent repo and move the beertent content into the root of it.
$ cd beerguide $ git rm -r harbour-beertent $ git mv harbour-beerguide/* ./ $ git commit -m "Remove beertent and put beerguide at the root"
To do the reverse for the beerguide repository.
Don't forget to set a sensible new remote for the new, clone repo:
$ git remote set origin git@github.com/tonercloud/beerguide.git
Steve