Roger Levy
Roger Levy

Reputation: 105

Git subtree that is dependent on the parent directory, or fork that only pushes some subfolders upstream

What I want to do in my project is fork an existing "framework" repository i've developed, and create a subfolder within the forked repo to store project-specific files (think "engine" and "game"). I want to retain the ability to make changes to the framework while working on this project, within a branch so as not to automatically affect the master branch should the fork be merged in, but I don't want to push the project subfolder (or any other project-related subfolders, should I want to add any) to the main framework repo on github. I DO want all the subfolders including any project-specific subfolders to be pushed to the project repo, keeping everything nicely packaged. Is there a way to do this without forcing the framework into a subfolder?

Upvotes: 0

Views: 323

Answers (1)

phd
phd

Reputation: 94502

Branches, branches everywhere!

Work on your subfolder in your private branch, let's name it 'private'. Fork off a branch from master to work on framework, named 'my-frm'. Merge my-frm to both master (and make pull requests with it) and also merge it to your private branch.

Upvotes: 1

Related Questions