If you need additional functionality, you must patch the program's source code with diff files. I don't think this principle scales well. If you change the source code, all patches will become invalid. How is it supposed to work?
I have a git branch where I apply my patches. If the master branch is updated I pull their upstream changes and then rebase my commits on top of theirs [1]. Once in a while conflicts may arise, but they’re usually solved easily.
Provided the source is reasonably organised the configurable variables etc are likely separate enough from any code you would care about patching.
Patch applying is quite robust, you do not need the code to be identical, the line numbers don't need to match exactly, it's most sensitive to the few lines of context.