git.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:boss 作者: kabirbaidhya 项目源码 文件源码
def last_commit(remote=True, short=False):
    '''
    Get the last commit of the git repository.

    Note: This assumes the current working directory (on remote or local host)
    to be a git repository. So, make sure current directory is set before using this.
    '''

    cmd = 'git rev-parse{}HEAD'.format(' --short ' if short else ' ')

    with hide('everything'):
        result = run(cmd) if remote else local(cmd, capture=True)

        return result.strip()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号