def update_git_repo():
    """Because GitPython sucks (cmd.commit() hangs)

    # pip install GitPython
    # import git
    # repo = git.Repo('.')
    # g = git.cmd.Git('.')
    # g.pull()
    # g.push()
    # g.commit()

    """
    today
    commands = """
        git add docs/*.html
        git add docs/images/
        git add docs*.ipynb
        git commit -am "autocommit new docs build {}"
        git push hobson
        git push origin

        git checkout master
        git merge gh-pages -m "automerge gh-pages into master"
        git push hobson
        git push origin

        git checkout gh-pages
        git merge master -m "automerge master into gh-pages"
        git push hobson
        git push origin
        """.format(datetime.datetime.today().isoformat())

    for cmd in commands.split('\n'):
        cmd = cmd.strip()
        if cmd:
            try:
                output = subprocess.check_output(cmd.split())
                print(output)
            except CalledProcessError:
                print_exc()
def update_git_repo ( ) : today commands = """
        git add docs/*.html
        git add docs/images/
        git add docs*.ipynb
        git commit -am "autocommit new docs build {}"
        git push hobson
        git push origin
        git checkout master
        git merge gh-pages -m "automerge gh-pages into master"
        git push hobson
        git push origin
        git checkout gh-pages
        git merge master -m "automerge master into gh-pages"
        git push hobson
        git push origin
        """ . format ( datetime . datetime . today ( ) . isoformat ( ) ) for cmd in commands . split ( '\n' ) : cmd = cmd . strip ( ) if cmd : try : output = subprocess . check_output ( cmd . split ( ) ) print ( output ) except CalledProcessError : print_exc ( )
Because GitPython sucks (cmd.commit() hangs)

    # pip install GitPython
    # import git
    # repo = git.Repo('.')
    # g = git.cmd.Git('.')
    # g.pull()
    # g.push()
    # g.commit()