Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid developers to commit without mention the issue on commit message on Github

At the company I'm working on we've defined a tiny development process to fit our needs. Before commit, we should mention the issue on the commit comments. This will trigger some internal hooks on our CI, and will make the issue available on our beta environment for testing.

Our project is currently hosted on GitHub, and we have a well configured Jenkins CI Server too. The doubt is: "how we can force our developers to mention a issue before commit?". I was wondering if Git Hooks could help us, but it seems that hooks are local on the developer machine.

Does anyone know something that could help us with this?

like image 973
Miere Avatar asked Nov 13 '22 16:11

Miere


1 Answers

I think your approach needs tweaking. Git is designed to be best when you commit often. For example, I often commit minor changes to multiple files as individual commits. Later changes can be squashed or cherry-picked, rebased, or rearranged. But forcing every commit to be regarding an issue will just lead to -fewer- commits, which isn't good for your developers.

In addition, code needs a backup, and if you push to a remote server, that's a simple way of having your code in two places, and also "sharing" with others during development. As long as it's a separate branch, that's a great way of working out problems in code.

As far as I can tell, your problem is with granularity and the concept of the github repository as being the "main" repository. If you only want to -deploy- for general testing a block of commits that deals with a specific issue, then have a git repo that pulls a copy of the central github repo on -every- commit to master, but only triggers the integration/deploy-to-testing process when there is an issue mentioned in the commit comments. In that way developers can push intermediate commits as needed, can push development branches as necessary without it having to mean anything special, and only issue-fixing commit blocks will cause deployment/integration.

like image 80
Kzqai Avatar answered Nov 15 '22 06:11

Kzqai