1. Upload the patch to the module directory.
2. Go to the module directory.
3. Run the following command.
patch -p1 < <file.patch>
4. To revert the change, run the following command.
patch -p1 -R < <file.patch>
Done =)
Reference: StackOverflow – Appliying patch in drupal modules