I want to update multiple files in my Gitlab repository using python-gitlab. I know how to update a single file but I do not want to update each file one by one.
Normally, we achieve this using these commands:
- Make your changes
- Git add
- Git commit
- Git push
Is there a way I can achieve this using python-gitlab?
# update a single file
file_path = "/tmp/test1.txt"
gl = gitlab.Gitlab("https://gitlab.example.com/", private_token=access_token)
project = gl.projects.get(3278)
file = project.files.get(file_path=file_path, ref="PR")
file.content = 'new content'
file.save(branch='PR', commit_message='Update testfile')