def commit(experiment_name, time):
    """
    Try to commit repo exactly as it is when starting the experiment for reproducibility.
    """
    try:
        sh.git.commit('-a',
                m='"auto commit tracked files for new experiment: {} on {}"'.format(experiment_name, time),
                allow_empty=True
            )
        commit_hash = sh.git('rev-parse', 'HEAD').strip()
        return commit_hash
    except:
        return '<Unable to commit>'
Try to commit repo exactly as it is when starting the experiment for reproducibility.