I'm building a web application that uses a third party JavaScript library (TinyMCE).
My application has some specific needs which require me to patch the library in a few places. The patches are easy (less than a dozen lines), but since they are specific to our use case and not bugs.
I'd like to be able to update when new versions of the library itself are released, which would overwrite our changes in our Git repository.
I need a way to ensure our patches are always applied before pushing the updated library to a production server. Since the changes are very small, it wouldn't be an issue to apply them manually.
How can I ensure my patches to third party code are applied in our repository when updating the third party code?
If you storing TinyMCE in a Git repo, then you could use a Git
post-commit-hook
to perform the patches after you get a new version of TinyMCE (then commit those patches).The workflow would be something like:
Create a repository for tracking the third-party code, and put your patches in a separate branch. When you need the latest release fetch the changes and rebase your branch.
For example:
Then make your patches and push to your repository:
At this point your repository looks like this:
Where X is your patch.
Now set a branch to fetch new revisions from the github remote:
So your repository becomes like this (
git branch
is smart enough to use as the origin the last revision in the github remote):At last rebase your master branch on tinymce_import: