I use Git for version control of all my projects. Every repository of course has many branches that I try to systematize like: stable, devel, experimental, per-feature etc. Many times I have run into the problem of committing my changes to the branch I did not intended to. Git shows you the branch and changed files when entering the commit message, but when you do that 50 times a day you are doomed to loose focus (and commit your experimental stuff into a stable branch 🙂 ).
My solution to this problem is a simple pre-commit hook that reads the name of the branch and prompts for confirmation, if the name of the branch is on a watchlist.
Continue reading “Git – confirmation before commit”