PHPackages                             drevops/git-artifact - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. drevops/git-artifact

ActivePackage[DevOps &amp; Deployment](/categories/devops)

drevops/git-artifact
====================

Package artifact from your codebase in CI and push it to a separate git repo.

1.4.0(3mo ago)2133.8k↓71.5%2[3 issues](https://github.com/drevops/git-artifact/issues)GPL-2.0-or-laterPHPPHP &gt;=8.3CI passing

Since Sep 6Pushed 2d ago4 watchersCompare

[ Source](https://github.com/drevops/git-artifact)[ Packagist](https://packagist.org/packages/drevops/git-artifact)[ Docs](https://github.com/drevops/git-artifact)[ GitHub Sponsors](https://github.com/drevops)[ Patreon](https://www.patreon.com/drevops)[ RSS](/packages/drevops-git-artifact/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (31)Versions (37)Used By (0)

  ![Git Artifact logo](logo.png)

Package and push files to a remote repository
---------------------------------------------

[](#package-and-push-files-to-a-remote-repository)

[![GitHub Issues](https://camo.githubusercontent.com/0a668aa4dafcd34c653e929d97e87f783b2dc996408de16424347a423520c38b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f647265766f70732f6769742d61727469666163742e737667)](https://github.com/drevops/git-artifact/issues)[![GitHub Pull Requests](https://camo.githubusercontent.com/dfc127ef11aef25bc88ebb177dcb0c69d2de1fd63b7a718bde59a570481e5427/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f647265766f70732f6769742d61727469666163742e737667)](https://github.com/drevops/git-artifact/pulls)[![GitHub release (latest by date)](https://camo.githubusercontent.com/5de065c0389c2b0c0dc801b38bf410116da13029f697838d72ff7c571422cc3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f647265766f70732f6769742d6172746966616374)](https://camo.githubusercontent.com/5de065c0389c2b0c0dc801b38bf410116da13029f697838d72ff7c571422cc3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f647265766f70732f6769742d6172746966616374)[![codecov](https://camo.githubusercontent.com/49bf760a5d287d303bf3c210da07c010a7c7589ba04fceb2208fd7857aab96d2/68747470733a2f2f636f6465636f762e696f2f67682f647265766f70732f6769742d61727469666163742f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d514e42584349424b354a)](https://codecov.io/gh/drevops/git-artifact)[![Total Downloads](https://camo.githubusercontent.com/c60c714ced023b94c0432a4712d3d5c88072fb80b1a1933dba62cacb64e65da0/68747470733a2f2f706f7365722e707567782e6f72672f647265766f70732f62656861742d73637265656e73686f742f646f776e6c6f616473)](https://packagist.org/packages/drevops/git-artifact)[![LICENSE](https://camo.githubusercontent.com/abb66d5ba9436eb2800c70987fba7b4cd481cb6134773d761cb0bdc17b4932c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f647265766f70732f6769742d6172746966616374)](https://camo.githubusercontent.com/abb66d5ba9436eb2800c70987fba7b4cd481cb6134773d761cb0bdc17b4932c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f647265766f70732f6769742d6172746966616374)[![Renovate](https://camo.githubusercontent.com/35389190ce58a3690fe850342c1c3fd4f54e4c10ba8996741c8558ee24bf50dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72656e6f766174652d656e61626c65642d677265656e3f6c6f676f3d72656e6f76617465626f74)](https://camo.githubusercontent.com/35389190ce58a3690fe850342c1c3fd4f54e4c10ba8996741c8558ee24bf50dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72656e6f766174652d656e61626c65642d677265656e3f6c6f676f3d72656e6f76617465626f74)

[![Test PHP](https://github.com/drevops/git-artifact/actions/workflows/test-php.yml/badge.svg)](https://github.com/drevops/git-artifact/actions/workflows/test-php.yml)[![CircleCI](https://camo.githubusercontent.com/41e02a29e724cd93ca2feceadf296df56891369b60a8ffd4678c55e5fd05826e/68747470733a2f2f636972636c6563692e636f6d2f67682f647265766f70732f6769742d61727469666163742e7376673f7374796c653d736869656c64)](https://circleci.com/gh/drevops/git-artifact)

[![Vortex Ecosystem](https://camo.githubusercontent.com/08d2ce6f52424a739d03c7df3f08b096f591c5198618d51756c11b2b69bde397/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462538432538302d566f7274657825323045636f73797374656d2d3243354136383f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d363541434243)](https://github.com/drevops/vortex)

---

🌟 With Git Artifact, you can:
-----------------------------

[](#-with-git-artifact-you-can)

📦 Assemble a code artifact locally or in CI
🧹 Exclude any unwanted files using a deployment `.gitignore`
📤 Transfer the final artifact to a destination Git repository for deployment
🔁 Choose between `force-push` or `branch` modes to fit your workflow

See example of deployed artifact in [Artifact branches](https://github.com/drevops/git-artifact-destination/branches).

🔀 Workflow
----------

[](#-workflow)

1️⃣ 🧑‍💻 Develop in the *source* repository
2️⃣ 📦 CI installs dependencies and runs **git-artifact** to package and push code to *destination* repository
3️⃣ 🚀 Hosting receives the code artifact and triggers a deployment

🎚️ Modes
--------

[](#️-modes)

### `force-push` mode (default)

[](#force-push-mode-default)

Push the packaged artifact to the **same branch** in the *destination* repository. This will carry over the branch history from the *source* repository and will overwrite the existing branch history in the *destination* repository.

```
==================================================
 🏃 Run 1
==================================================

Local repo                  Remote repo
                            +------------------+
                            | Artifact commit  | 💥 New commit
                            +------------------+
+-----------+               +------------------+
| Commit 2  |               | Commit 2         | \
+-----------+  ==  📦  ==>  +------------------+  ) 👍 Source commit
| Commit 1  |               | Commit 1         | /   history preserved
+-----------+               +------------------+
 `mybranch`                      `mybranch`

                                     👆
                        Branch name identical to source

==================================================
 🏃 Run 2
==================================================

Local repo                    Remote repo
                            +------------------+
                            | Artifact commit  | 💥 New commit
                            +------------------+
+-----------+               +------------------+
| Commit 4  |               | Commit 4         |  \
+-----------+               +------------------+   \
| Commit 3  |               | Commit 3         |    \
+-----------+  ==  📦  ==>  +------------------+     )  👍 Source commit
| Commit 2  |               | Commit 2         |    /    history preserved
+-----------+               +------------------+   /
| Commit 1  |               | Commit 1         |  /
+-----------+               +------------------+
 `mybranch`                      `mybranch`

                                     👆
                       Branch name identical to source

```

#### Use case

[](#use-case)

Forwarding all changes in the *source* repository to the *destination*repository **as-is** for **every branch**: for example, a commit in the *source*repository branch `feature/123` would create a commit in the *destination*repository branch `feature/123`. The next commit to the *source* repository branch `feature/123` would update the *destination* repository branch `feature/123` with the changes, but would overwrite the last "artifact commit".

### `branch` mode

[](#branch-mode)

Push the packaged artifact to the **new branch** in the *destination* repository. This will carry over the branch history from the *source* repository to a dedicated branch in the *destination* repository. The follow-up pushes to the branch in the *destination* repository will be blocked.

```
==================================================
 🏃 Run 1
==================================================

Local repo                  Remote repo
                            +------------------+
                            | Artifact commit  | 💥 New commit
                            +------------------+
+-----------+               +------------------+
| Commit 2  |               | Commit 2         | \
+-----------+  ==  📦  ==>  +------------------+  ) 👍 Source commit
| Commit 1  |               | Commit 1         | /    history preserved
+-----------+               +------------------+

 `mybranch`                  `deployment/1.2.3`
 tagged with
   `1.2.3`

     👆                              👆
 Tagged branch              New branch based on tag

==================================================
 🏃 Run 2
==================================================

Local repo                    Remote repo
                            +------------------+
                            | Artifact commit  | 💥 New commit
                            +------------------+
+-----------+               +------------------+
| Commit 4  |               | Commit 4         |  \
+-----------+               +------------------+   \
| Commit 3  |               | Commit 3         |    \
+-----------+  ==  📦  ==>  +------------------+     )  👍 Source commit
| Commit 2  |               | Commit 2         |    /    history preserved
+-----------+               +------------------+   /
| Commit 1  |               | Commit 1         |  /
+-----------+               +------------------+

 `mybranch`                  `deployment/1.2.4`
 tagged with
   `1.2.4`  👈 New tag 1.2.4

     👆                              👆
 Tagged branch            New branch based on a new tag
 with a new tag

```

#### Use case

[](#use-case-1)

Creating a **new branch** in the *destination* repository for every **tag**created in the *source* repository: for example, a tag `1.2.3` in the source repository would create a branch `deployment/1.2.3` in the destination repository. The addition of the new tags would create new unique branches in the destination repository.

📥 Installation
--------------

[](#-installation)

### As a standalone binary

[](#as-a-standalone-binary)

This tool is intended to be used as a standalone binary. You will need to have PHP installed on your system to run the binary.

Download the latest release from the [GitHub releases page](https://github.com/drevops/git-artifact/releases/latest).

### As a Composer dependency

[](#as-a-composer-dependency)

You may also install this tool globally using Composer:

```
composer global require --dev drevops/git-artifact:~1.1
```

#### 📌 Version constraint

[](#-version-constraint)

When using `git-artifact` in CI/CD scripts, we recommend using **Tilde Version Range Operator** to ensure stability. The tilde constraint allows patch updates (e.g., `1.0.0` → `1.1.1`) but blocks minor version updates (e.g., `1.1.0` → `1.2.0`).

This ensures that:

- **Security fixes and bug patches** are automatically applied
- **CI/CD pipelines remain stable** - no unexpected breaking changes
- **Minor version updates are blocked** - these may introduce behavioral changes that could affect deployments

This is especially important in CI/CD environments where deployment reliability is critical and changes should be tested before adoption.

▶️ Usage
--------

[](#️-usage)

```
./git-artifact git@github.com:yourorg/your-repo-destination.git
```

This will create an artifact from current directory and will send it to the specified remote repository into the same branch as a current one.

Avoid including development dependencies in your artifacts. Instead, configure your CI to install production-only dependencies, export the resulting code, and use that as the artifact source. See our CI examples below.

Call from the CI configuration or deployment script:

```
export DEPLOY_BRANCH=
./git-artifact git@github.com:yourorg/your-repo-destination.git \
  --branch="${DEPLOY_BRANCH}" \
  --push
```

CI providers may report branches differently when packaging is triggered by tags. We encourage you to explore our continuously and automatically tested examples:

- [GitHub Actions](.github/workflows/test-php.yml)
- [CircleCI](.circleci/config.yml)

See extended and fully-configured [example in the Vortex project](https://github.com/drevops/vortex/blob/develop/scripts/vortex/deploy-artifact.sh).

🎛️ Options
----------

[](#️-options)

NameDefault valueDescription`--ansi`Force ANSI output. Use `--no-ansi` to disable`--branch``[branch]`Destination branch with optional tokens (see below)`--dry-run`Run without pushing to the remote repository`--fail-on-missing-branch`Fail artifact packaging if source branch cannot be determined. By default, artifact packaging is skipped gracefully`--gitignore`Path to the `.gitignore` file to replace the current `.gitignore``--log`Path to the log file`--message``Deployment commit`Commit message with optional tokens (see below)`--mode``force-push`Mode of artifact packaging: `branch`, `force-push``--no-cleanup`Do not cleanup after run`--now`Internal value used to set internal time`--root`Path to the root for file path resolution. Uses current directory if not specified`--show-changes`Show changes made to the repo during packaging in the output`--src`Directory where source repository is located. Uses root directory if not specified`-V, --version`Display this application version`-h, --help`Display help for the given command`-n, --no-interaction`Do not ask any interactive question`-q, --quiet`Do not output any messages`-v, --verbose`Increase the verbosity of messages: 1 for normal, 2 for more verbose, 3 for debug🧹 Modifying artifact content
----------------------------

[](#-modifying-artifact-content)

`--gitignore` option allows to specify the path to the artifact's `.gitignore`file that replaces existing `.gitignore` (if any) during packaging. Any files no longer ignored by the replaced artifact's `.gitignore` are added into the deployment commit. If there are no no-longer-excluded files, the deployment commit is still created, to make sure that the deployment timestamp is captured.

🏷️ Token support
----------------

[](#️-token-support)

Tokens are pre-defined strings surrounded by `[` and `]` and may contain optional formatter. For example, `[timestamp:Y-m-d]` is replaced with the current timestamp in format `Y-m-d` (token formatter), which is PHP [`date()`](https://www.php.net/manual/en/function.date.php) expected format.

Both `--branch` and `--message` option values support token replacement.

Available tokens:

- `[timestamp:FORMAT]` - current time with a PHP [`date()`](https://www.php.net/manual/en/function.date.php)-compatible `FORMAT`.
- `[branch]` - current branch in the source repository.
- `[safebranch]` - current branch in the source repository with with all non-alphanumeric characters replaced with `-` and lowercased.
- `[tags:DELIMITER]` - tags from the latest commit in the source repository separated by a `DELIMITER`.

Maintenance
-----------

[](#maintenance)

### 🧪 Testing

[](#-testing)

Packaging and deployment of artifacts is a mission-critical process, so we maintain a set of unit, functional and integration tests to make sure that everything works as expected.

You can see examples of the branches created by the Git Artifact in the [example *destination* repository](https://github.com/drevops/git-artifact-destination/branches).

### Lint and fix code

[](#lint-and-fix-code)

```
composer lint
composer lint-fix
```

### Run tests

[](#run-tests)

```
composer test
```

---

*Repository created using  project scaffold template*

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 62.7% 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 ~103 days

Recently: every ~87 days

Total

31

Last Release

90d ago

Major Versions

0.10.0 → 1.0.02025-03-29

PHP version history (4 changes)0.1.0PHP &gt;=5.5.0

0.6.0PHP &gt;=8.1

0.7.0PHP &gt;=8.2

1.1.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/b57b0fd0b96f77f2efa1a1889af0ae607fa139bcc1256e809ee3ebbb30907364?d=identicon)[alexdrevops](/maintainers/alexdrevops)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (205 commits)")[![AlexSkrypnyk](https://avatars.githubusercontent.com/u/378794?v=4)](https://github.com/AlexSkrypnyk "AlexSkrypnyk (115 commits)")[![tannguyen04](https://avatars.githubusercontent.com/u/2858879?v=4)](https://github.com/tannguyen04 "tannguyen04 (7 commits)")

---

Tags

acquiaartefactartifactcomposerdevopsgitpackagephp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/drevops-git-artifact/health.svg)

```
[![Health](https://phpackages.com/badges/drevops-git-artifact/health.svg)](https://phpackages.com/packages/drevops-git-artifact)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[laravel/framework

The Laravel Framework.

34.7k532.1M19.2k](/packages/laravel-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)

PHPackages © 2026

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