TLDR: This is my general process of modifying code from Github (or other) that I use (could be an Octopress theme or a cocoapod or any other open source code one might use), all while maintaining the ability to update and contributing back (sometimes)…
Recently I installed Octopress theme by Adrian Artiles, for this blog.
As suggested by Adrian using git submodule, in octopress
My first post was link-post (see Link Bloging). When checking out the preview of the blog with the new link post I noticed that the post title did not link to the external-url of the post…
Long story short I found what’s needed to be changed in the theme to make the post title link to external site.
At this point I do the following:
- Fork the project on Github.
Change the submodule origin to the forked repo:
$ cd /submodule/path $ git remote set-url origin https://github.com/[your-user]/[forked-repo].git
Add the original repo of the fork as upstream:
cd /submodule/path git remote add upstream https://github.com/[user-forked-from]/[repo-forked-from].git
Create a new branch in the submodule with the name of the change (I create a branch for each change that is applied).
Apply the fix / change.
Pull request back to upstream.
To use all the changes done I sometimes create a
beta branch and merge all the changes to there.
That way future updates are easy to do:
- Pull changes from
upstreamremote into (submu)
- Merge changes from
masterinto your branches.