PHPackages                             ahmedessam/laravel-git-toolkit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ahmedessam/laravel-git-toolkit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ahmedessam/laravel-git-toolkit
==============================

A toolkit for managing git repositories in Laravel applications.

v2.1.0(11mo ago)22191MITPHPPHP ^8.2

Since Oct 9Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/aahmedessam30/laravel-git-toolkit)[ Packagist](https://packagist.org/packages/ahmedessam/laravel-git-toolkit)[ RSS](/packages/ahmedessam-laravel-git-toolkit/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (5)Versions (12)Used By (0)

Laravel Git Toolkit
===================

[](#laravel-git-toolkit)

[![Laravel Git Toolkit](https://camo.githubusercontent.com/5edd00b166094fd51b9a260c57c742314d7b6954f081b3b2691bad784b5fca13/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230476974253230546f6f6c6b69742e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d61686d6564657373616d2532466c61726176656c2d6769742d746f6f6c6b6974267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d496e746567726174652b4769742b6f7065726174696f6e732b77697468696e2b796f75722b4c61726176656c2b70726f6a656374732b746f2b6d616e6167652b4769742b776f726b666c6f77732b6d6f72652b656666696369656e746c79266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d636f6465)](https://camo.githubusercontent.com/5edd00b166094fd51b9a260c57c742314d7b6954f081b3b2691bad784b5fca13/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230476974253230546f6f6c6b69742e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d61686d6564657373616d2532466c61726176656c2d6769742d746f6f6c6b6974267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d496e746567726174652b4769742b6f7065726174696f6e732b77697468696e2b796f75722b4c61726176656c2b70726f6a656374732b746f2b6d616e6167652b4769742b776f726b666c6f77732b6d6f72652b656666696369656e746c79266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d636f6465)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5be2ba9d37517baefab80dd01e81ddd8fcce7c32d8cf5c8a87162a248159ec7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61686d6564657373616d2f6c61726176656c2d6769742d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ahmedessam/laravel-git-toolkit)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b30779262d6664ffec872e7f7036b62f46e31dc4b97481eb67e0bc8094a47a2c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f796f75722d757365726e616d652f6c61726176656c2d6769742d746f6f6c6b69742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/your-username/laravel-git-toolkit/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1e1c90f4c09962ba4d7eca1853b2d3b0111d08e3c565036fd263b63df6124361/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f796f75722d757365726e616d652f6c61726176656c2d6769742d746f6f6c6b69742f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/your-username/laravel-git-toolkit/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/6a30382ee6068916c70eaffa478d1a2dd42ea789e3173c1578550f1f33ee13ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61686d6564657373616d2f6c61726176656c2d6769742d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ahmedessam/laravel-git-toolkit)

Laravel Git Toolkit is a comprehensive package that integrates Git operations within your Laravel projects. It provides commands and services to help manage Git workflows more efficiently, with support for Git Flow, conventional commits, and modern Laravel architecture patterns.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require ahmedessam/laravel-git-toolkit
```

You can publish the configuration file with:

```
php artisan vendor:publish --tag=git-toolkit-config
```

Environment Variables
---------------------

[](#environment-variables)

The package uses the following environment variables:

- `GIT_PUSH_TO_DEFAULT_BRANCH` - Whether to push changes to the default branch. Default is `false`.
- `GIT_DEFAULT_BRANCH` - The default branch to push changes to. Default is `current`.
- `GIT_PUSH_WITH_DEFAULT_MESSAGE` - Whether to push changes with the default commit message. Default is `false`.
- `GIT_DEFAULT_COMMIT_TYPE` - The default commit type. Default is `feat`.
- `GIT_DEFAULT_COMMIT_MESSAGE` - The default commit message. Default is `Update [%s] branch with latest changes.`.
- `GIT_PUSH_AFTER_COMMIT` - Whether to push changes after committing. Default is `true`.
- `GIT_RETURN_TO_PREVIOUS_BRANCH` - Whether to return to the previous branch after committing. Default is `true`.
- `GIT_DELETE_AFTER_MERGE` - Whether to delete the merged branch after merging. Default is `false`.
- `GIT_FLOW_ENABLED` - Whether to enable Git flow branches. Default is `true`.

You can add these environment variables to your `.env` file.

copy the following code to your `.env` file:

```
GIT_PUSH_TO_DEFAULT_BRANCH=false
GIT_DEFAULT_BRANCH='current'
GIT_PUSH_WITH_DEFAULT_MESSAGE=false
GIT_DEFAULT_COMMIT_TYPE='feat'
GIT_DEFAULT_COMMIT_MESSAGE='Update [%s] branch with latest changes.'
GIT_PUSH_AFTER_COMMIT=true
GIT_RETURN_TO_PREVIOUS_BRANCH=true
GIT_DELETE_AFTER_MERGE=false
GIT_FLOW_ENABLED=true
```

Notes
-----

[](#notes)

- The package uses the `git` command to perform Git operations.
- The package asks few questions to get the required data to perform the operation.
- The package provides a list of flags to specify the required data to perform the operation.
- The package uses the following flags:
    - `--branch` flag to specify the branch name.
    - `--message` flag to specify the commit message.
    - `--type` flag to specify the commit type.
    - `--merge` flag to specify the branch to merge.
    - `--return` flag to specify whether to return to the previous branch.
    - `--commit` flag to specify the commit hash to reset to.

Usage
-----

[](#usage)

To initialize git flow branches, run the following command:

```
php artisan git:flow
```

This command will create the following main branches:

- `main`
- `develop`
- `staging`
- `hotfix`

You can also create feature, fix, and release branches, package ask for theses branches names.

To commit changes, run the following command:

```
php artisan git push
```

This command will add all changes, commit them, and push them to the current branch.

To create a new branch, run the following command:

```
php artisan git branch
```

This command will create a new branch based on the type you choose.

To pull changes from the remote repository, run the following command:

```
php artisan git pull
```

This command will pull changes from the remote repository to the current branch or the branch you specify.

To merge branches, run the following command:

```
php artisan git merge --merge= --branch=
```

### Flags

[](#flags)

- `--merge` flag to specify the branch to merge from.
- `--branch` flag to specify the branch or branches sperated by comma or space to merge into.
- **ex:** `php artisan git merge --merge=feature --branch=develop,main`

This command will merge the specified branch into the branch you specify.

To delete a branch, run the following command:

```
php artisan git delete-branch
```

This command will delete the specified branch.

To Push new branch to remote repository, run the following command:

```
php artisan git push-branch
```

To Fetch changes from the remote repository, run the following command:

```
php artisan git fetch
```

This command will fetch changes from the remote repository.

To Rebase changes from the remote repository, run the following command:

```
php artisan git rebase
```

This command will rebase changes from the remote repository.

To Reset changes from the remote repository, run the following command:

```
php artisan git reset --commit=
```

This command will reset changes from the remote repository.

Features
--------

[](#features)

✨ **Core Git Operations**

- Initialize Git flow branches with customizable naming
- Commit changes with conventional commit messages
- Create branches for features, fixes, releases, hotfixes, or custom types
- Pull, push, merge, delete, fetch, rebase, and reset operations

🏗️ **Modern Architecture**

- Contract-based service architecture
- Event-driven operations for extensibility
- Pipeline validation system
- Comprehensive exception handling
- Dependency injection throughout

🎯 **Laravel Integration**

- Laravel 9-12 compatibility
- Artisan command integration
- Service provider with automatic discovery
- Configuration management
- Event system integration

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 9.x, 10.x, 11.x, or 12.x
- Git installed and configured
- Remote repository access (SSH recommended)

Architecture
------------

[](#architecture)

### Contracts

[](#contracts)

The package uses contract interfaces for clean dependency injection:

```
// GitRepositoryInterface for Git operations
app(GitRepositoryInterface::class)->getCurrentBranch();

// ConfigInterface for configuration access
app(ConfigInterface::class)->get('commit_types');
```

### Events

[](#events)

Listen to Git operations in your application:

```
Event::listen(BranchCreated::class, function ($event) {
    Log::info("Branch created: {$event->branchName}");
});

Event::listen(CommitPushed::class, function ($event) {
    Log::info("Commit pushed: {$event->commitHash}");
});
```

### Services

[](#services)

Access core services directly:

```
// Branch operations
$branchService = app(BranchService::class);
$branchName = $branchService->sanitizeBranchName('feature/my-feature');

// Commit message building
$commitBuilder = app(CommitMessageBuilder::class);
$message = $commitBuilder->buildCommitMessage('feat', 'Add new feature');

// Git repository operations
$gitRepo = app(GitRepository::class);
$branches = $gitRepo->getAllBranches();
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run tests with coverage:

```
composer test-coverage
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details on how to contribute.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

The Laravel Git Toolkit is open-sourced software licensed under the [MIT license](LICENSE).

Author
------

[](#author)

- **Ahmed Essam**
    - [GitHub Profile](https://github.com/aahmedessam30)
    - [Packagist](https://packagist.org/packages/ahmedessam/api-versionizer)
    - [LinkedIn](https://www.linkedin.com/in/aahmedessam30)
    - [Email](mailto:aahmedessam30@gmail.com)

Contributing
------------

[](#contributing-1)

Contributions are welcome! Please feel free to submit a Pull Request.

Issues
------

[](#issues)

If you find any issues with the package or have any questions, please feel free to open an issue on the GitHub repository.

Enjoy using Laravel Git Toolkit! 🚀

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance51

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~66 days

Total

11

Last Release

347d ago

Major Versions

v1.7.0 → v2.0.02025-07-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/14383efd445985cf037e39f51ce0228eab1800ddf41cd845457daae1bcd8c192?d=identicon)[aahmedessam30](/maintainers/aahmedessam30)

---

Top Contributors

[![aahmedessam30](https://avatars.githubusercontent.com/u/63825434?v=4)](https://github.com/aahmedessam30 "aahmedessam30 (34 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ahmedessam-laravel-git-toolkit/health.svg)

```
[![Health](https://phpackages.com/badges/ahmedessam-laravel-git-toolkit/health.svg)](https://phpackages.com/packages/ahmedessam-laravel-git-toolkit)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)[livewire/flux

The official UI component library for Livewire.

9527.8M128](/packages/livewire-flux)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.2k14](/packages/tallstackui-tallstackui)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

198321.1k](/packages/fumeapp-modeltyper)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
