How to write a commit message
When you contribute code to the PrestaShop project (through Github), we ask that you strictly use the PrestaShop way of writing a commit/pull request message. This way, when building the code history, your commit message will fit nicely with the ones from the PrestaShop developers and contributors.
Commit naming convention
The commit's name must be in English, and should be formatted like this:
[type] category : short description
The title of the pull request should be the same as its commit, and must follow the same convention.
If the pull request has several commits, the title of the pull request should either use the name of the most important commit, or should reflect the overall change of the pull request.
Type
The type is the general idea behind your commit: are you fixing a bug, making an improvement, etc.?
Type | Meaning |
---|---|
[-] | Bug fix. |
[*] | Improvement. |
[+] | New feature. |
[~] | Feature deprecation. |
Please make sure that one commit/pull request does only one thing. If you made both a fix and an improvement in the code, either use the most important change in the commit message, or make two commits/pull request.
Category
The category is the portion of the project to which your changes apply to.
Category | Meaning |
---|---|
FO | Front office (theme, front controller, images, CSS, JavaScript, etc.). |
BO | Back office (theme, admin controller, images, CSS, JavaScript, etc.). |
CORE | The core of the software itself: classes, controllers, etc. |
Installer | All the files in the |
TR | The translation files. |
MO | Modules. Please specify the module's name in the content of commit message. |
Deprecated | When deprecating some code. Please specify the class name and its function name. |
Security | Security fixes, such as XSS fixes. |
Project | Changes affecting the entire project. |
PDF template modifications. | |
WS | Web Service. |
LO | Localization pack. |
TEST | Unit tests or functional test. |
Short description
Use the description to explain what your commit does in a few words. Try to be concise!
If you fixed a ticket from the Forge, please add a link to that ticket in the first comment and specify the bug's Forge number in the description (eg: #PSCFV-007).
Description of the commit/pull request
You can put more details in the commit description.
If your code change requires a lot of explanation, please open a Forge ticket explaining your intent with this code change, so that the Product team can discuss it with you. Once the ticket is created, link to it from the PR's comment, and give a link to the PR from the ticket, in order to bridge the two.
Sample commit message
Here are a few sample messages:
[-] BO : Fixed bug while updating images in AdminProduct [*] FO : You can now buy products without TVA [+] MO : New RSS Feed module [~] Deprecated : Product::getReductionValue()
Adding the correct license to new files
By submitting your code to the PrestaShop project, you are releasing it under a Open Source license: either OSL or AFL.
If you add new files, they need to have the "NOTICE OF LICENSE" and the "DISCLAIMER" sections at the start of the file.
- For general PrestaShop files: the notice should mention the OSL 3.0 license.
- For module files: the notice should mention the AFL 3.0 license.
You can copy/paste from existing files in the project.
You can also use this for general files:
<?php /** * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2015 PrestaShop SA * @version Release: $Revision: 6844 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */
...or for modules...
/** * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */