AI-Powered Git Commit Message Generator

0 downloads

askrobots_commitgen/git_operations.py
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/askrobots_commitgen.git
HTTPS
https://gitstable.com/git/askrobots/askrobots_commitgen.git
SSH
ssh://git@gitstable.com:2222/askrobots/askrobots_commitgen.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Create commit message adjusting OpenAI initialization and error handling. c0d2e25 2 years, 6 months ago History
git_operations.py · 324 bytes · 10 lines
1import subprocess
2
3def get_git_diff() -> str:
4 try:
5 # Using --cached to get the diff of staged changes
6 diff = subprocess.check_output(["git", "diff", "--cached"], text=True)
7 return diff
8 except subprocess.CalledProcessError as e:
9 print(f"Error getting git diff: {e}")
10 return ""