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 -- __ __| |_ __ __ .----------------------------------------------. / _/ _` \ V V / | mailto:alug_cdw@the-walker-household.co.uk | \__\__,_|\_/\_/ |______________________________________________|
-----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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVZtRcAAoJEL/3HArzwYbRd/YP/j+yWRu6MUVy9WwsToZn1PDZ d4sITdZzwuVnI6gw3yJaAQJjJJUqZLc9ElsiBNwBwO02lHR8MBkR2m/7pv0Mq/8S DFCTRU/U0fkYNwqN2tya2hNcL2D5RgJH6mRsdWlXcI/j14CMt525vzM0+ch7SUgX ROzCk9/S7R1kpsp4MparGP1RCaqMT19tktLfYL6aLJb7/l43/vrDI3niE+0vj1lu R5OHD8m0tv5A9RWDT7P5PuCGdTy6pKfGXCxVXCz1XPhkJzFfdj6kFkYXZq14S4UK Up1z3UdPUj5zLNZnXFJK/gJ9FgdtVbwdk8cka0vuNK3qTvOL2MT5QmkA2M42Or86 J7cw5lgKURxp+gwkOO6W0HuQv1Dpsdf/2f11Is4Qc9F7xQbK6+cUY2hdylYX7LXR 9BJhEwM88SJLPkvyr3aJCrWud8HEF0Yuq/czBqUvWMObpZl9dg/PR+s3q1mNa3Kq 8TXPdTPVYwQP+BsriR/kzmsSbhAKHt74MlHjhc+gQg+V7mak0Vs2Wqa7GVFX53+K IxwlJV2rVrgiISEO3eCnkSQAYFWkGiMFe4xLa/RaL2UfUB/4xFYgsbbP1o7GcDWU RqhBmJbH4seuTq6d3hyv+jVszohUcLpNEsxOKJPKCi7oMDn7QKsyW9GBAu42F+i/ uNBj9A0Bbu00QySpWEuQ =wWPg -----END PGP SIGNATURE-----
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..." ;-) -- __ __| |_ __ __ .----------------------------------------------. / _/ _` \ V V / | mailto:alug_cdw@the-walker-household.co.uk | \__\__,_|\_/\_/ |______________________________________________|
-----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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVZuqiAAoJEL/3HArzwYbRyIAQAI3C1aQbKunlVkkuxaFzDl5W GdGBekPDl3J80OpEp3SR48856iWitGpeYsDmTWwP0ucy0Ljy3PU+wnrsRa2xZU8O P/Ea1URFVm3qXDQDxVLUDDyEKTY5WS4f+Z/qf0WHNrkinOB/lIqDFSR1MgIwIx1a Ww237oBydO0uPt0XYCf5FddVH8DdfeUdRT2Nu7Lk0qfOLAFzLsa8XQU1B7WV9MsC SXW4ZbihYjtyEDPM1o33cVGA1DjVjXF2VJGl67tOzvZz6EdVxOe7U6rddY0RtnSO 5U0UIQ/4xf/RQ3zWI7hNujyAQ4RjC/6bxOFxQGl0Virk8T9BOutuimNEHAdqgbfx Ua5BiAZNUtzXDQWksamSGrmSHWAF/ctksteYCa7XPzQ2Z803Rp/vcalaNU6Jla19 U9EqCXzKtD7ErW6TOb0R5JZZivy8oBoP6vDQyvXVGcJzE+CNxhejabLfglpDvZ2U u2YO0xGUJonE9Ase34SdSZL21b7nWebD3l12enx9XFg4OIZJZV8GYlmeGedMm+p6 jrP2ywD9agpvLM5LcAKS/jA6s6jWVLKRL1FmbAmElGP3JyeGmJrUxs84WjCi0LBp uZ09Y2jR1R48bmhfAcUTUloi6mDvziasXKYYL2vcQ3Wlnd2d99lClZsC7BIqq1rE sEQTz6zXN+/MmlztyXdm =OE1g -----END PGP SIGNATURE-----
participants (2)
-
Chris Walker -
Steve Engledow