User Tools

Site Tools


devel:git-commit-guidelines

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
devel:git-commit-guidelines [2014/12/15 13:53]
miconda [Read-Only Cloning of GIT Repository]
devel:git-commit-guidelines [2018/10/24 22:30]
henningw add explanations about github forking
Line 1: Line 1:
 ====== GIT Commit Guidelines ====== ====== GIT Commit Guidelines ======
 +
 +===== GIT Repository Location =====
 +
 +Starting with December 15, 2014, the main GIT repository of Kamailio project is hosted on Github at:
 +
 +  * https://github.com/kamailio/kamailio
 +
 +A read-only mirror is maintained at:
 +
 +  * git.kamailio.org (still accessible via git.sip-router.org) - web interface:
 +    * http://git.kamailio.org
  
 ===== Cloning GIT Repository ===== ===== Cloning GIT Repository =====
Line 31: Line 42:
  
 The clone is tracking automatically the remote **master** branch (the development version). The clone is tracking automatically the remote **master** branch (the development version).
 +
 +===== Working with Github forks of a GIT Repository =====
 +
 +If you don't have developer write access, you can fork the Kamailio repository. Then you checkout the forked repository to your local disk and do the changes. Commit the changes to your repository and create a pull request to integrate your changes into the Kamailio repository back. Have a look e.g. to this documentation:
 +
 +[[hhttps://help.github.com/articles/fork-a-repo/|Github help - forking]]
 +[[https://help.github.com/articles/about-pull-requests/|Github help - pull request]]
  
 ===== Read-Only Cloning of GIT Repository ===== ===== Read-Only Cloning of GIT Repository =====
 +
 +**Working with a fork of the Kamailio repository and then submitting a pull request is nowadays the preferred way to integrate your contributions, if you don't have write permissions to the Kamailio repository. Please see above.**
  
 If you don't have developer write access, you can clone read-only the repository with: If you don't have developer write access, you can clone read-only the repository with:
Line 113: Line 133:
   * module_name: support for foo   * module_name: support for foo
   * lib_name: critical bug fix   * lib_name: critical bug fix
- 
-If the module_name is duplicated, one in modules_k and one in modules_s, add (k) or (s), depending where the changes was done, for example: 
-  * auth_db(k): fixed typo in comment 
-  * auth_db(s): fixed typo in comment 
  
 Examples of commit messages: Examples of commit messages:
  
-  * change to usrloc module from modules_k+  * change to usrloc module from modules
 <code> <code>
-usrloc(s): fixed name conflict+usrloc: fixed name conflict
  
 - destroy_avps() renamed to reg_destroy_avps() to avoid conflicts - destroy_avps() renamed to reg_destroy_avps() to avoid conflicts
Line 145: Line 161:
   * http://www.tpope.net/node/106   * http://www.tpope.net/node/106
  
 +==== Content of the Commit Message ====
 +
 +    * the message must be addressed for humans, using common sense language. All commit messages are part of the ChangeLog file for each release and that file is read by sysadmins and other non-developer people 
 +    * the message must be strictly related to the changes in the C code (e.g., don't give instructions what another developer must do with your patch)
 +    * credits to persons or companies that helped in the context of the commit are allowed and it is fair to be added whenever is the case. The place is at the end of the commit message (or end of the part describing the related change)
 +    * don't use slang and don't abuse using abbreviations, especially when it is not an official abbreviation
 +    * don't use system or tools commands to express the changes of the commit. They can be given as an example in the detailed message to show how the changes were done, but text explanation must be first. E.g., if you renamed a function, don't use as commit message 's/oldfunc/newfunc/'.
 ===== Generic Guidelines ===== ===== Generic Guidelines =====
  
Line 152: Line 175:
   * do the commits per one module when changing in a module and other modules are affected and were updates as well   * do the commits per one module when changing in a module and other modules are affected and were updates as well
   * when updating the documentation and it is intended to do a backport, split the commit in one for xml files and one for the README file. Usually the commit to xml files can be backported without conflict (with git cherry-pick ...). README files are many times generated with different character sets, a matter of the system where they are generated, resulting in backporting conflicts. Thus is better to backport only the commit for xml files and generate the README for that branch, then push it to remote GIT repository   * when updating the documentation and it is intended to do a backport, split the commit in one for xml files and one for the README file. Usually the commit to xml files can be backported without conflict (with git cherry-pick ...). README files are many times generated with different character sets, a matter of the system where they are generated, resulting in backporting conflicts. Thus is better to backport only the commit for xml files and generate the README for that branch, then push it to remote GIT repository
 +    * **IMPORTANT**: the README files for modules must no longer be generated by the developer and pushed to GIT. There is a tool running on server auto-generating the README file shortly after the xml files of the module's docs are updated and pushed to GIT repository
   * if it is a change that has to be repeated in many places, then the commit can be done at once to all changes. For example, renaming a token that is present in all docbook files, removing or adding a new field in a structure such as module exports.   * if it is a change that has to be repeated in many places, then the commit can be done at once to all changes. For example, renaming a token that is present in all docbook files, removing or adding a new field in a structure such as module exports.
  
Line 295: Line 319:
 <code> <code>
 git push origin :<branchName> git push origin :<branchName>
 +</code>
 +
 +As of Git v1.7.0, a remote branch can be deleted using:
 +
 +<code>
 +git push origin --delete <branchName>
 +</code>
 +
 +==== Revert already pushed commit ====
 +
 +This will produce a commit reverting the previous commit <hash>
 +
 +<code>
 +git revert <hash>
 +git push origin
 +</code>
 +
 +==== Rename and commit file ====
 +
 +Create minimal commit when renaming file
 +
 +<code>
 +git mv module.c module_mod.c
 +git commit -m '...: renamed module file to match recommended pattern' module.c module_mod.c
 </code> </code>
devel/git-commit-guidelines.txt ยท Last modified: 2018/10/24 22:33 by henningw