I want to fetch all files and directories present in a git repo using Python and then parse through each directory to get details of files present under them.
Below is the piece of code I have been trying but it returns nothing. I am able to get branch details.
import git
import os
from git import Repo
Repo.clone_from(repo_url,local_path)
repo = git.Repo(local_path)
remote = repo.remote("origin")
for branches in remote.refs:
//code to get a specific branch, say abc, using if condition
repo.git.checkout(abc)
os.listdir(local_path)
Here's one example: