GitFit - A pre-commit hook using the Fitbit API

console screenshot

What it does

Prevents you from committing code unless you've met your primary Fitbit goal for the day.


After coming home from work, I eat dinner in front of my TV and frequently code all night. This is quite unhealthy. To limit my all-nighters, I need to enforce some restrictions on myself. Now, in order to commit code I must first meet one of my Fitbit goals (10,000 steps, 5 miles, or being very active for 30 minutes). If I miss my goal the commit is rejected -- which also means I can't deploy.

Areas for improvement: right now, even if I hit my goal, I can't code after midnight. Then again, that may not be such a bad thing.


  1. Install the Python Fitbit API wrapper pip install fitbit
  2. Make sure hook is executable chmod u+x pre-commit & saved to your hooks folder (global or repo level)
  3. Create a new Fitbit app & note down your API keys
  4. Get your userid by visiting your profile online & noting down the string that comes after (mine is 2SZVTN)
  5. Make sure your Activities are public here:
  6. Try committing something
Share this project: