Skip to content

Instantly share code, notes, and snippets.

View dmcguire81's full-sized avatar

David McGuire dmcguire81

View GitHub Profile
@dmcguire81
dmcguire81 / README.md
Last active December 14, 2015 08:49 — forked from mbbx6spp/README.md

Subdirectory Git Repository

This is a mini howto on moving a subdirectory to its own repository retaining history

Howto

Assume PARENT is the original parent Git repository (locally) and CHILD is the new local repository that you wish to create from a subdirectory, retaining all of its history from the PARENT repository; PARENT_PATH and CHILD_PATH are the paths to PARENT and CHILD respectively; SUBDIR is the relative path within the repository under extraction:

  1. git clone --no-hardlinks PARENT_PATH CHILD_PATH
  2. pushd CHILD_PATH