Pessy
Pessy

Reputation: 21

Avoid pushing multiple commits

I want to avoid pushing multiple commits to remote repository. Is there a config option in git which will disallow or warn when multiple commits are being pushed to the remote branch?

Upvotes: 0

Views: 319

Answers (1)

Robert Glickman
Robert Glickman

Reputation: 65

I believe you can do this through a git hook, either pre-push on the client-side or pre-receive on the server-side.

You can see more about these hooks here: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

This has an example of how you might script this: Git hook pre-push prompt to squash commits first

Upvotes: 1

Related Questions