Zeroclickinfo-goodies: Use server side hooks to prevent commits to the cloned master branch

Created on 23 May 2017  路  3Comments  路  Source: duckduckgo/zeroclickinfo-goodies

I had seen many developers cloning our repo and committing their changes to the master branch of their cloned repo, They are not following the git branched workflow. Developers that are not familiar with using git may get into this problem and may end up with an unclean master branch.

The solution

  • I think adding a pre-commit hook to the repo will solve the problem.

AFAIK we can use git server server side hook to make it possible: https://git-scm.com/book/gr/v2/Customizing-Git-An-Example-Git-Enforced-Policy

We cant use client side hooks since they are not persistent while cloning: https://git-scm.com/book/gr/v2/Customizing-Git-Git-Hooks#_client_side_hooks

What is your opinion @duckduckgo/community-leaders?

I will be happy to implement this one if you are interested 馃槃. I am new to git hooks, please correct me if i had any mistakes.

Discussion Suggestion

Most helpful comment

@gautamkrishnar Unfortunately Github doesn't let you use server-side hooks.

It might be a job for Danger, I know we've explored using it in the past. We could also start with emphasizing the git checkout -b step in the docs more.

All 3 comments

@gautamkrishnar Unfortunately Github doesn't let you use server-side hooks.

It might be a job for Danger, I know we've explored using it in the past. We could also start with emphasizing the git checkout -b step in the docs more.

I remember talking about introducing pre-commit hooks in one of the mails. They will surely help avoid accidental errors, linting code, making custom checks and much more before creating a commit. This can be done on client side. Although one can bypass them if they want to, it will help reduce the number of incidents.

We cant use client side hooks since they are not persistent while cloning: https://git-scm.com/book/gr/v2/Customizing-Git-Git-Hooks#_client_side_hooks

This might add a few steps on client side where we would need to set it up after cloning the repo.

I'm going to close this and add it to the community leader call agenda for this thursday. I think we may actually conclude this there: https://forum.duckduckhack.com/t/meeting-june-2017/2048/3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sam09 picture sam09  路  17Comments

rushsteve1 picture rushsteve1  路  13Comments

spagy picture spagy  路  19Comments

pjhampton picture pjhampton  路  17Comments

moollaza picture moollaza  路  24Comments