PHPackages                             facebook/fbshipit - 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. facebook/fbshipit

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

facebook/fbshipit
=================

Library for syncing code repositories

v2.2.0(2y ago)3955.2k103[10 issues](https://github.com/facebook/fbshipit/issues)MITHack

Since Jun 7Pushed 2y ago42 watchersCompare

[ Source](https://github.com/facebook/fbshipit)[ Packagist](https://packagist.org/packages/facebook/fbshipit)[ RSS](/packages/facebook-fbshipit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (6)Used By (0)

FBShipIt
========

[](#fbshipit)

NOTE: This project is no longer maintained. Meta has switched to using a (currently) closed-source solution to this that we hope to release in the future. Existing Open Source users can check out [Copybara](https://github.com/google/copybara).

FBShipIt is a library written in [Hack](http://hacklang.org) for copying commits from one repository to another.

For example, Meta uses it to:

- copy commits from our monolithic Mercurial repository to project-specific GitHub repositories
- sync changes from project specific repos like CPython and the linux kernel
- Import changes from PyTorch into our Mercurial monorepo

Major Features
--------------

[](#major-features)

- read from Git or Mercurial (hg) repositories
- write to Git or Mercurial (hg) repositories
- remove files or directories matching certain patterns
- remove/rewrite sections of commit messages
- modify commit authors (for example, if all internal commits are authored by employees, restore original authors for GitHub pull requests)

Major Limitations
-----------------

[](#major-limitations)

FBShipIt has been primarily designed for branches with linear histories; in particular, it does not understand merge commits.

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

[](#requirements)

- [HHVM (latest release)](https://docs.hhvm.com/hhvm/installation)
- [Composer](https://getcomposer.org/doc/00-intro.md)

Installing
----------

[](#installing)

```
$ composer require facebook/fbshipit

```

How FBShipIt Works
------------------

[](#how-fbshipit-works)

There are three main concepts: phases, changesets, and filters.

`ShipItPhase` objects represent a high-level action, such as 'clone this repository', 'pull this repository', 'sync changesets', and 'push repository'.

Within the sync phase, a `ShipItChangeset` is an immutable object representing a commit.

Filters are functions that take a Changeset, and return a new, modified one.

### Provided Phases

[](#provided-phases)

- `ShipItCreateNewRepoPhase`: creates a new Git repository with an 'initial commit'. Skipped unless `--create-new-repo` passed.
- `ShipItAssertValidFilterPhase`: make sure that the filter is consistent with the specified roots.
- `ShipItGitHubInitPhase`: create and configure a github clone.
- `ShipItPullPhase`: pull in any new changes to a repository.
- `ShipItPushPhase`: push local changes to the destination repository.
- `ShipItSyncPhase`: copy commits from the source repository to the destination repository.
- `ShipItVerifyRepoPhase`: check that the destination repository matches the source repository and filter. Skipped unless `--verify` or `--create-fixup-patch` is passed.

Using FBShipIt
--------------

[](#using-fbshipit)

You need to construct:

- a `ShipItManifest` object, defining your default working directory, and the directory names of your source and destination repositories
- a list of phases you want to run
- a pipeline of filters, assuming you are using the `ShipItSyncPhase`

Filters are provided for common operations - the most frequent are:

- `ShipItPathFilters::moveDirectories(string $changeset, dict $mapping)`: apply patches to a different directory in the destination repository
- `ShipItPathFilters::stripPaths(string $changeset, vec $patterns, vec $exception_patterns = vec[])`: remove any modifications to paths matching `$patterns`, unless they match something in `$exception_patterns`.

Example
-------

[](#example)

See the [`demo/`](demo) directory for a simple example to start from.

Using With An Empty Destination Repository
------------------------------------------

[](#using-with-an-empty-destination-repository)

Add `ShipItCreateNewRepoPhase` to your phase list (after source init and pull phases), then run:

```
hhvm my_script.hack --create-new-repo

```

This will give you the path to a git repository with a single commit; you can then push it to your destination.

Using With An Existing Destination Repository
---------------------------------------------

[](#using-with-an-existing-destination-repository)

When there is at least one relevant commit in the source repository that is not in the destination repository, run:

```
hhvm my_script.hack --first-commit=FIRST_UNSYNCED_COMMIT_ID_GOES_HERE

```

Future Runs
-----------

[](#future-runs)

Run your script with no arguments; FBShipIt adds tracking information to the commits it creates, so will automatically sync any new commits.

Reducing Common Code With Multiple Projects
-------------------------------------------

[](#reducing-common-code-with-multiple-projects)

We recommend splitting out common filters and phase setup to separate classes, and for these to be re-used between your projects. For an example from Facebook's usage, see [FBCommonFilters](fb-examples/lib/shipit/FBCommonFilters.php-example)

Further Examples
----------------

[](#further-examples)

Some other code that might be useful for configuring FBShipIt can be found in [fb-examples/](https://github.com/facebook/fbshipit/tree/master/fb-examples).

License
-------

[](#license)

FBShipIt is MIT-licensed.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Total

4

Last Release

1066d ago

Major Versions

v1.0.0 → v2.0.02020-10-22

### Community

Maintainers

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

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

---

Top Contributors

[![bigfootjon](https://avatars.githubusercontent.com/u/6403568?v=4)](https://github.com/bigfootjon "bigfootjon (319 commits)")[![yns88](https://avatars.githubusercontent.com/u/757922?v=4)](https://github.com/yns88 "yns88 (188 commits)")[![sdwilsh](https://avatars.githubusercontent.com/u/656602?v=4)](https://github.com/sdwilsh "sdwilsh (146 commits)")[![fredemmott](https://avatars.githubusercontent.com/u/360927?v=4)](https://github.com/fredemmott "fredemmott (123 commits)")[![facebook-github-bot](https://avatars.githubusercontent.com/u/6422482?v=4)](https://github.com/facebook-github-bot "facebook-github-bot (47 commits)")[![zpao](https://avatars.githubusercontent.com/u/8445?v=4)](https://github.com/zpao "zpao (31 commits)")[![mroch](https://avatars.githubusercontent.com/u/3012?v=4)](https://github.com/mroch "mroch (19 commits)")[![passy](https://avatars.githubusercontent.com/u/9906?v=4)](https://github.com/passy "passy (16 commits)")[![simpkins](https://avatars.githubusercontent.com/u/163549?v=4)](https://github.com/simpkins "simpkins (13 commits)")[![nataliejameson](https://avatars.githubusercontent.com/u/6351854?v=4)](https://github.com/nataliejameson "nataliejameson (13 commits)")[![snarkmaster](https://avatars.githubusercontent.com/u/2081923?v=4)](https://github.com/snarkmaster "snarkmaster (12 commits)")[![periodic1236](https://avatars.githubusercontent.com/u/1748071?v=4)](https://github.com/periodic1236 "periodic1236 (11 commits)")[![zertosh](https://avatars.githubusercontent.com/u/830952?v=4)](https://github.com/zertosh "zertosh (10 commits)")[![jjergus](https://avatars.githubusercontent.com/u/2483917?v=4)](https://github.com/jjergus "jjergus (9 commits)")[![gabelevi](https://avatars.githubusercontent.com/u/1887264?v=4)](https://github.com/gabelevi "gabelevi (7 commits)")[![davide125](https://avatars.githubusercontent.com/u/397089?v=4)](https://github.com/davide125 "davide125 (7 commits)")[![orionr](https://avatars.githubusercontent.com/u/79994?v=4)](https://github.com/orionr "orionr (6 commits)")[![kassens](https://avatars.githubusercontent.com/u/11849?v=4)](https://github.com/kassens "kassens (6 commits)")[![priteshrnandgaonkar](https://avatars.githubusercontent.com/u/3865908?v=4)](https://github.com/priteshrnandgaonkar "priteshrnandgaonkar (6 commits)")[![DavidSnider](https://avatars.githubusercontent.com/u/10112104?v=4)](https://github.com/DavidSnider "DavidSnider (6 commits)")

---

Tags

commitsfacebookgithackhacklangmercurialsyncfacebookhackFBShipIt

### Embed Badge

![Health badge](/badges/facebook-fbshipit/health.svg)

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

PHPackages © 2026

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