⚡ Live Interactive Code Sandbox: AI Dev Tool: ZCode the GLM coding
▶️ Run Code
💳 Unlock Source Code ($5)
📝 Editable Code Sandbox
```python # AI Dev Tool: GitGuard - Protecting Git History from Unwanted Uploads # Description: A CLI automation tool to detect and prevent silent uploads of Git history # Requirements: Python 3.8+, gitpython, Pydantic import os import git from pydantic import BaseModel from typing import List, Optional from git.exc import GitCommandError class GitHistory(BaseModel): """Git history model""" commits: List[str] branches: List[str] tags: List[str] class GitGuard: """GitGuard class to protect Git history""" def __init__(self, repo_path: str): """ Initialize GitGuard with repository path Args: repo_path (str): Path to the Git repository """ self.repo_path = repo_path self.repo = git.Repo(repo_path) def get_git_history(self) -> GitHistory: """ Get Git history Returns: GitHistory: Git history model """ try: commits = [commit.hexsha for commit in self.repo.iter_commits()] branches = [branch.name for branch in self.repo.branches] tags = [tag.name for tag in
🖥️ Interactive Execution Terminal Console
⚡ Ready! Click ▶️ Run Code to execute code in browser terminal...