Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Splitting Off a Folder Into Its Own Repo - Git

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Tue, May 11, 2021, 9:20 AM


Background

We had a folder on a project which contains all the front-end code. We wanted this folder to be split off into its own GitHub repo so a new front-end developer, a contractor, wouldn't have access to the back end code. This is the procedure that was done.

Reference


Procedure

  • Sync with GitHub
    • Pull all commits
    • Commit and push all local changes
  • Make a full backup of the repo (optional)
    • GitHub
      • Create new repo > "MyRepo.Backup"
    • Git Bash
      • cd "/C/Users/JohnDoe/Documents/MyRepo.Backup"
      • git clone bare https://github.com/soltechinc/MyRepo.git
      • cd "MyRepo.git"
      • git push mirror https://github.com/soltechinc/MyRepo.Backup.git
  • Split the repo
    • GitHub
      • New repo > MyRepo.FrontEnd
    • Git Bash
      • cd "/C/Users/JohnDoe/Documents/MyRepo.FrontEnd"
      • git clone bare https://github.com/soltechinc/MyRepo.git
      • cd "MyRepo.git"
      • The next step took about 14 minutes
      • git filter-branch prune-empty subdirectory-filter front-end-folder-name all
      • git remote -v
      • git remote set-url origin https://github.com/soltechinc/MyRepo.FrontEnd.git
      • git remote -v
      • git push mirror https://github.com/soltechinc/MyRepo.FrontEnd.git

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.