Useful Git commands

Sometimes when using apps checked out from Git an update might break something so it’s good to know a few git commands. Move to root of the app folder you had checked out to perform git commands.

git log
This command will list all the commits so you can see at which commit you are and pick the one before yours and copy the commit hashcode it will be a long string.

git checkout hashcode
With ‘hashcode’ being the commit hashcode copied from the log. This command will move/revert your app/code to the commit you specified. Just restart your app after that to run it with the new code.

git checkout master
This command will move your code to the master branch from development. Do this if you want your app to be more stable Alpha/Developement branches break now and then as people checkin new code. They have the benefit of getting new features before the stable branch if you don’t mind having something break now and then which is ok with me 🙂

Python IMAP search and SMTP with Gmail

Recently I had a need to search through my gmail and fwd some emails on a daily basis. I checked out Gmails rest interface but it was a bit of an overkill for what I was doing. So I settled on just plain IMAP and SMTP. The main idea was search through my inbox using several search parameters, get all the emails that match the pattern and fwd them to a list of emails. So I wrote a script to do this and had cron call the script at the end of the day. I put up the source in github for anyone interested.