axle import
axle import https://github.com/acme/billing.git packages/billingaxle import ../billing packages/billing --branch developaxle import <repository> <folder> moves a project that lived in a repository of its own into the monorepo. Its files land in the folder, and its commits stay in the history: git log -- packages/billing shows them, and git blame still finds who wrote each line.
The repository is anything git fetch takes: an address, or a folder on this computer. Axle imports its default branch, or the one given with --branch. A folder is taken from where you run axle import, and the folder to import into from the repository’s root. A user name and password in an address are left out of the commit message and of what Axle prints.
What it does
Section titled “What it does”- It checks that this repository has no changes waiting to be committed, so the import is a commit of its own, and that the folder doesn’t exist yet.
- It fetches the branch, then makes one merge commit,
Import <repository> into <folder>, that adds the branch’s files under the folder and keeps its history reachable. No history is rewritten, here or in the other repository. - It says whether the folder is inside the workspace, and which install command links its packages, such as
pnpm install.
When a step fails, nothing is imported and the repository is as it was. If the folder isn’t one of the workspace’s patterns, add it to workspaces in package.json, or packages in pnpm-workspace.yaml, before installing.
Options
Section titled “Options”| Option | What it does |
|---|---|
--branch <branch> |
the branch to import, instead of the default one |
Messages
Section titled “Messages”import-needs-a-clean-tree: there are changes that aren’t committed.import-folder-exists: the folder is already there.import-failed: Git couldn’t fetch or merge the repository.not-a-git-repositoryandgit-missing: there is no Git repository, or no Git.