I forget things.  A  lot.  I need a to do list tracker that works with me.  So I wrote one.  I, being me, used the technologies I use the most to make this happen:  bash and git.

I had originally done the same thing with SVN, and that worked too, but I recently decided to go straight git.  Probably the most important reason was that my SVN setup was world readable, and I didn’t want my todo list to be visible by everyone:  If I need to remember the address for a baby sitter,  or that I have to go and get an invasive surgical procedure, it is none of your business.

The set up is pretty simple.  I have an account on a remote server where I have a git repository.  Actually, I have two.  One is a raw one, that acts as the keeper of  the todo list, and one that pulls from the raw one as part of the publishing process.  Two bash scripts, too, one of which runs on the server. This (slightly modified to not post my name and email everywhere) is the one that runs from a cron job, :



pushd ~/todo

git fetch
git rebase origin/master

TITLE=`head -1 $OUTFILE`
cat $OUTFILE | mail -s "$TITLE"


Here’s the crontab

0 5 * * 1-6 /home/username/

thie is the script I run on my laptop. I call it add_todo, and keep it in $HOME/bin, which I have added to my path.


until [ -z "$1" ]  # Until all parameters used up . . .

pushd $HOME/Documents/todo

echo $TODOLINE  >>  todo.txt

git add .
git commit -m "TODO: $TODOLINE"
git push
ssh  todo/

What is really interesting about this is what it says about git and ssh as message delivery system. This system has the following things built in: git push is idempotent: call it as many times as you wanat, a message gets delivered exactly once. Message delivery is a transaction and verifiable. You get a log of all activity. You get conflict notifications, and pretty good automated merging. It is secure by design. You get logging, history, and audit built in. It is efficient.

If you wanted, you could build a pretty efficient publish/subscribe system on top of branches.

2 thoughts on “add_todo

  1. $@ is still an array and doesn’t become a single value. Doing it with the loop means I don’t have to put quotes around the todo Items list.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.