Sharing Commits Between Repos
If you want to make a template available to the public but need to keep your own implementation in a private repository, such as a website theme or a job application template, this may be the sort of git flow you need.
Add repositories as remotes
Add the public to the private and the private to the public so cherry picking can be done both ways.
From the private repo:
git remote add template git@github.com:username/my-awesome-template
From the public repo:
git remote add personal git@github.com:username/my-awesome-implementation
Cherry pick feature commit(s)
Example: Assume that a feature was added to the personal implementation in a branch called awesome-feature that needs to be introduced to the public repo.
From the public repo:
git fetch personal
git log personal/awesome-feature -n 5
git cherry-pick ${commit-hash}
And if there’s no need to bother with manually resolving conflicts, you can choose to accept all incoming changes:
git cherry-pick -X theirs ${commit-hash}
Checkout files directly
If your commit is not strictly separated into personal and public changes, then checkout the files directly from the public repo:
git fetch template
git checkout personal/master path/to/file - caj