Using Git from Python with GitPython
GitPython is a library that makes it easy to automate any git actions you want to repeat (in my case, updating my notes with links to my recently-liked YouTube videos).
Here’s how to use it.
1. Install
…
Stuff to review…
- Use Git commands within Python code - Stack Overflow - or just
import subprocess
and use `subprocess.run([“git”, “command”, “you”, “need”] - Execute git commands in python and configure credentials - Stack Overflow - another suggestion to just use
subprocess
along withos.chdir
if you need to change directories - Automating some git commands with Python - GeeksforGeeks - uses gitpython extensively
- GitPython Tutorial — GitPython 3.1.43 documentation
- Python Tutorial | How to Work with GIT and GITHUB using Python || Clarusway - YouTube - video about gitpython the commenters seem to quite like
- Using Git From Python - Waylon Walker post
- How can I call ‘git pull’ from within Python? - Stack Overflow - stack overflow post cautioning about proper gitpython api usage (and which way of using it to avoid)
- GitPython Tutorial — GitPython 3.1.43 documentation