PHPackages                             derhasi/staging - 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. derhasi/staging

ActiveBash-script[DevOps &amp; Deployment](/categories/devops)

derhasi/staging
===============

A helper script to deploy the exact code state from one branch to a remote branch.

1.1.1(10y ago)310.9kGPL-2.0+Shell

Since Feb 20Pushed 10y ago1 watchersCompare

[ Source](https://github.com/derhasi/staging)[ Packagist](https://packagist.org/packages/derhasi/staging)[ RSS](/packages/derhasi-staging/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

staging
=======

[](#staging)

[![travis ci test status](https://camo.githubusercontent.com/a3ea1bbdb6267718c318cebf8501d363c94edda8cfff16bba4eafdf7587807e8/68747470733a2f2f6170692e7472617669732d63692e6f72672f646572686173692f73746167696e672e737667)](https://camo.githubusercontent.com/a3ea1bbdb6267718c318cebf8501d363c94edda8cfff16bba4eafdf7587807e8/68747470733a2f2f6170692e7472617669732d63692e6f72672f646572686173692f73746167696e672e737667)

A helper script to deploy a specific code state from one git in another git repo.

Bash script for deploying the exact state of a given branch to a remote branch. This is done by using "diff commits".

This script is for adjusting the staging branch to a specific branch content. The resulting branch will likely not share the history with the given branch, but will ensure all files are present in the same state as in the original branch.

This approach is needed to ensure we can use the a git based hosting with a fixed branch, to rollout and test multiple different branches. In that case we have got a single staging branch to deploy to. That branch only will get "diff commits" that changes the file state to a defined state of the given branch.

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

[](#installation)

### via composer

[](#via-composer)

`composer global require derhasi/staging`

### Manually

[](#manually)

```
curl -O https://raw.githubusercontent.com/derhasi/staging/master/staging
chmod u+x staging
mv staging /usr/local/bin/staging
```

## Usage:

The command creates a commit on the `remoteBranch` with the exact code state of the `sourceBranch`.

```
staging [-hv] [-m "..."] {remote} {remoteBranch} {sourceBranch}"
```

In _local branch mode_ the state is applied on a local branch without pushing to a remote repository.

```
staging -l [-hv] [-m "..."] {localBranch} {sourceBranch}"
```

### Arguments

1. `{remote}`: Name of the remote repository to push the code to. Example: `origin`
2. `{remoteBranch}`: Name of the remote branch to push the code to. Example: `master`
3. `{sourceBranch}`: Name of the branch to get the code from. May be a local or a remote branch reference.
   Examples: `mybranch` or `origin/66-hello`

### Options

* `-h`: Shows help message for the command
* `-v`: Provides verbose output
* `-m "Custom commit message"`: Replaces the default message (`Staging: [source branch] (sha: [source sha])`) with the
  given custom one
* `-l`: Enables _local branch mode_

### Features

* Stashes the current uncommited changes of the current branch, and switches back to that state, after deploying the
  commit diff.

## Example

You have one stage environment available, where you are only allowed to push code via git. The corresponding git
repository is located at `https://stage.example.com/site.git`. The branch to deploy to is `master`.
Now, you have got several branches in development (`123-story`, `124-event`, `125-contact`) you want to test on that
staging environment. You can do that, one after another using _staging_.

First, add your stage remote to your local repo: `git remote add stage https://stage.example.com/site.git`.

Now you can deploy the code to your stage from any arbitrary branch.

Let's start with the first: `staging stage master 123-story`.
After that `git diff 123-story stage/master` would show no difference.

With executing `staging stage master 124-event`, you will get the same for `git diff 123-story stage/master`.

You even can enter `staging stage master origin/125-contact` to directly work with the a remote branch instead of a
local branch.

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~62 days

Total

3

Last Release

3980d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5613deedd974152f066c46795af9d5dd85cb84bd0c05ebb921287479c82b0c0f?d=identicon)[derhasi](/maintainers/derhasi)

---

Top Contributors

[![derhasi](https://avatars.githubusercontent.com/u/118502?v=4)](https://github.com/derhasi "derhasi (46 commits)")

---

Tags

gitbash

### Embed Badge

![Health badge](/badges/derhasi-staging/health.svg)

```
[![Health](https://phpackages.com/badges/derhasi-staging/health.svg)](https://phpackages.com/packages/derhasi-staging)
```

###  Alternatives

[banago/phploy

PHPloy - Incremental Git (S)FTP deployment tool that supports submodules, multiple servers and rollbacks.

1.4k47.2k](/packages/banago-phploy)[pomander/pomander

Deployment for PHP

19815.7k2](/packages/pomander-pomander)[fortrabbit/craft-copy

Tooling for Craft on fortrabbit

7617.2k1](/packages/fortrabbit-craft-copy)

PHPackages © 2026

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