git –newbie-mode-on

git is great. Powerful and fast, and amazingly good at merging, etc. However, people new to git, or people who used to use Subversion and now have to use git because it’s more popular, can quickly end up bringing havoc into the repo.

It’s not something that cannot be “fixed” by reverting back to a “good” commit, but just basically un-gitty habits that get a repository into a messy bunch of obscure commits.

Maybe git should add a new feature that would detect if a user is new to git. Or maybe all new git installations would default to enabling that by default, and git will reveal to you the command line switch to disable –newbie-mode-on only after you’ve behaved properly for a while. For example:

$ git commit -m 'implemented feature #1000'
[master 96f0ea4] implemented feature #1000
 1 files changed, 1 insertions(+), 1 deletions(-)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! ACHIEVEMENT UNLOCKED !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You just unlocked the advanced mode.

You're not a newbie anymore.

If you need to reinstall your system, but don't want to go back
to newbie mode, use the following command to unlock it:

$ git ******************************

When in newbie mode, git would refuse commits that matched one or more of the following characteristics:

  • a commit with too many files (probably a sign that the commit corresponds to many different new functionalities)
  • attempts to commit or push to master, instead of to a feature branch
  • has a too short commit message, or no message at all
  • or the commit message is gramatically/syntactically incorrect
  • with left over debugger; statements (or equivalent for the detected programming language)
  • has abundant console.* calls (or equivalent: for example: printf)

I’m pretty sure something like this could be implemented with some sort of git hook. Feel free to use the idea :-P