(targets, message, force=False, sign=False, update=False)
Commit the changes for the given targets.

    `targets` - be files or directories
    `message` - the commit message
    `force` - (optional) force the commit
    `sign` - sign with `-S` option
    `update` - only commit updated files already tracked by git, via `-u`
Commit the changes for the given targets.
Commit the changes for the given targets .
def git_commit(targets, message, force=False, sign=False, update=False):
    """
    Commit the changes for the given targets.

    `targets` - be files or directories
    `message` - the commit message
    `force` - (optional) force the commit
    `sign` - sign with `-S` option
    `update` - only commit updated files already tracked by git, via `-u`
    """
    root = get_root()
    target_paths = []
    for t in targets:
        target_paths.append(os.path.join(root, t))

    with chdir(root):
        if update:
            result = run_command(f"git add{' -f' if force else ''} -u {' '.join(target_paths)}")
        else:
            result = run_command(f"git add{' -f' if force else ''} {' '.join(target_paths)}")
        if result.code != 0:
            return result

        return run_command('git commit{} -m "{}"'.format(' -S' if sign else '', message))
def git_commit ( targets , message , force = False , sign = False , update = False ) : root = get_root ( ) target_paths = [ ] for t in targets : target_paths . append ( os . path . join ( root , t ) ) with chdir ( root ) : if update : result = run_command ( f"git add{' -f' if force else ''} -u {' '.join(target_paths)}" ) else : result = run_command ( f"git add{' -f' if force else ''} {' '.join(target_paths)}" ) if result . code != 0 : return result return run_command ( 'git commit{} -m "{}"' . format ( ' -S' if sign else '' , message ) )