Skip to content

Instantly share code, notes, and snippets.

@myoffe
Last active December 20, 2015 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myoffe/6202354 to your computer and use it in GitHub Desktop.
Save myoffe/6202354 to your computer and use it in GitHub Desktop.
Send OSX notifications during the day to remind you how much your branch is lagging behind master. WIP: doesn't work. Trying to migrate to launchd plist
[alias]
curbranch = rev-parse --abbrev-ref HEAD
offset = !git log $(git curbranch)..master

Requirements

  1. terminal-notifier (gem install terminal-notifier)
  2. envoy and terminal notifier wrapper (pip install envoy pync)
import os
from pync import Notifier
import envoy
cmd = envoy.run('git offset | wc -l')
commits_behind = int(cmd.std_out)
if (commits_behind > 0):
branch = envoy.run('git curbranch').std_out
Notifier.notify('%s is behind master by %s commits.' % (branch, commits_behind), title='git')
# Sun-Thu, at 10am, 2pm and 6pm.
# Assumes "code" will get you to your working copy
* 10,14,18 * * 0,1,2,3,4 code && python ~/Scripts/behind-master-notify.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment