def tag(name, remote=False, commit=None):
    """Add a local tag with that name at that commit

    If no commit is given, at current commit on cuurent branch
    If remote is true, also push the tag to origin
    """
    command = 'tag %s %s' % (name, commit or '')
    result = run(command)
    if remote:
        push('origin %s' % name)
    return result