Can somebody help me with some git commands please?
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.
I created a folder on my machine called beerguide_gitrepo/ and having looked at this page and run step 3 - https://help.github.com/articles/splitting-a-subfolder-out-into-a-new-reposi... that folder now contains a beertent folder and that in turn now has two sub-folders harbour-beertent and harbour-beerguide.
But so does beertent_gitrepo.
I've done as far as step 4 but that's where I am reluctant to go any further for fear of royally screwing things up.
Step 5 says I should run 'git filter-branch' but for me, it lacks clarity. As I said above, I want to remove the beertent name and just leave things named harbour-*
So can anybody tell me precisely the command(s) I should type in to remove harbour-beerguide from the local beertent_gitrepo and similarly remove harbour-beertent from the local beerguide_gitrepo and remove the beertent folders completely?
TIA
-----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
On Thu, 28 May 2015 09:39:57 +0100 Steve Engledow steve@offend.me.uk wrote:
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
Unknown option: -rm
$ git mv harbour-beerternst/* ./
Did that ok
$ git commit -m "Remove beerguide and put beertent at the root"
Did that ok too. When do I do a 'push'?
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
error: Unknown subcommand: set
I did say ".. tell me precisely the command(s) I should type in..." ;-)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 28/05, Chris Walker wrote:
$ git rm -r harbour-beerguide
Unknown option: -rm
I think you typoed ;)
$ git commit -m "Remove beerguide and put beertent at the root"
Did that ok too. When do I do a 'push'?
Whenever you like :)
$ git remote set origin git@github.com/tonercloud/beerguide.git
error: Unknown subcommand: set
*ahem* ok so I typoed too, that should've been:
$ git remote set-url origin git@github.com/tonercloud/beerguide.git
Steve