Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Git Laravel Package

sebastianfeldmann/git

PHP library to access and interact with Git repositories. Provides a simple API for common Git commands and info (status, log, branches, tags), ideal for build scripts, CI tooling, and automation where you need Git data without shelling out manually.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing via Composer: composer require sebastianfeldmann/git. Once installed, instantiate the Git class (or Repository depending on version) by pointing it to an existing local Git repository path. Your first use case is likely inspecting repo status or running simple commands—e.g., $repo = new Git('/path/to/repo'); $status = $repo->status();. Check the README or examples/ directory for minimal snippets (if available); otherwise, the class constructor and factory methods like Repository::fromPath() are your entry points.

Implementation Patterns

  • Encapsulate workflows: Wrap common sequences (e.g., pull → checkout → fetch tags → build) in reusable methods or services.
  • Command chaining: Use fluent-style or method composition for multi-step operations (e.g., checkout('main')->pull()->fetch('--tags')).
  • Output parsing: Leverage built-in result objects (e.g., StatusResult, BranchResult) to safely extract structured data instead of raw strings.
  • CI/automation: Inject the Git client into Symfony Console commands, Laravel Artisan commands, or GitHub Actions runners—no framework lock-in required.
  • Error handling: Expect GitExceptions for failures; pair try/catch with descriptive logging or rollback logic for robust automation.

Gotchas and Tips

  • Path sensitivity: Always resolve paths absolutely—relative paths may behave inconsistently across environments (e.g., cron vs CLI).
  • Environment isolation: Ensure GIT_DIR and GIT_WORK_TREE aren’t overridden externally; the library respects these but conflicts can cause silent errors.
  • Non-interactive mode: The library runs Git in batch/non-interactive mode (-c advice.detachedHead=false, etc.) to avoid hangs—avoid using interactive commands like rebase -i.
  • Version compatibility: Older Git versions may lack flags or output formats; check the git --version support matrix in source comments if seeing parse errors.
  • Extensibility: Extend Command classes or implement custom ResultParser interfaces if you need specialized parsing (e.g., for git log --pretty=format:).
  • Debugging: Enable setOutputHandler() or inspect getLastCommand() on the client to replay failing commands manually in the shell.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport