git prompting me before commit

git

Solution

Set your prompt appropriately and see the branch that you are in always - https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh

If you want better tools like better git prompt, ruby version prompt, python virtualenv prompt, etc. try `bash-it`- https://github.com/revans/bash-it

If you want the exact solution that you describe here, set up some alias script for git commit, setup a `pre-commit` hook etc which will see your current branch and prompt you as needed.

Problem

Is there a way git prompts me a "You are attempting to make a commit in the production branch. Are you sure (y/N)?" message before every commit. As it is obvious from the message, I want it only on a specific branch (say production branch) to avoid any spurious commits.

Original source