Skip to content

Instantly share code, notes, and snippets.

@shuxue051
shuxue051 / auto_pull_github.py
Created September 14, 2014 14:33
自动pull github
# -*- coding: utf-8 -*-
import urllib2
import json
import subprocess
#通过git log命令获得最新的sha
run1 = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE)
run2 = subprocess.Popen(["grep", "commit"], stdin=run1.stdout, stdout = subprocess.PIPE)
commit, error = run2.communicate()