def get_new_and_modified_files()

in utils/hub_sync.py [0:0]


def get_new_and_modified_files(local_dir) -> List[str]:
    """
    Returns a list of untracked and modified files in the working directory recursively.
    It will include relative path for files under sub-dirs that are untracked.
    """

    try:
        cmd = "git ls-files --modified --others --exclude-standard".split()
        output = subprocess.run(
            cmd,
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE,
            check=True,
            encoding="utf-8",
            cwd=local_dir,
        ).stdout.strip()
    except subprocess.CalledProcessError as exc:
        raise EnvironmentError(exc.stderr)

    if len(output) == 0:
        return []

    return [f.strip() for f in output.split("\n")]