How can I create a patch for a contrib module or core which is not in version control? Because we use a devOps system that installs packages on the server via Composer, my core drupal installation and contrib modules are not in version control (Git). 

I used to patch modules as follows:


Commit everything, so my branch is up-to-date.
Make my changes to the module (= write the fixes in the module).
Inside my code editor go to Code -> Create patch and follow the steps there (because of Git, my editor knows what has changed).
My patch gets saved where I prefer to do it.


Since we started working with keeping modules and core out of Git I do not have a clue on how to create my patches anymore. 

Curious about the solutions you might have!
So, you would have to download the module seperately, like:

git clone --branch 8.1.x http://git.drupal.org/project/colorbox.git


Then, you make the change and run the following:

git diff 8.1.x &gt; colorbox-css-issue.patch


This creates a patch for this module. Now you can place the patch in a patches folder and add it to your composer.json file.
Helpful source: https://www.drupal.org/node/707484