Skip to content

Working Copy

Working Copy is a powerful Git client for iOS that clones, edits, commits, pushes and more. Protocol Launcher allows you to generate deep links to perform Git operations in Working Copy.

Usage

There are two ways to use this library:

  • On-Demand import from subpaths enables tree-shaking and keeps bundles small.
  • Full Import from the root package is convenient but includes all app modules.

Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.

Select Installation Method

On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.

Simple Commands

Open

Open Working Copy app.

On-Demand
ts
import { open } from 'protocol-launcher/working-copy'

const url = open()

Clone

Ask Working Copy to open the clone dialog with a specific URL.

On-Demand
ts
import { clone } from 'protocol-launcher/working-copy'

const url = clone({
  remote: 'https://github.com/zhensherlock/watermark-js-plus.git',
})

Show

Show a remote repository inside Working Copy, cloning as needed.

On-Demand
ts
import { show } from 'protocol-launcher/working-copy'

const url = show({
  remote: 'https://github.com/zhensherlock/watermark-js-plus.git',
})

Open Screen

Open Working Copy at a specific screen.

On-Demand
ts
import { openScreen } from 'protocol-launcher/working-copy'

const url = openScreen({
  repo: 'my project',
  path: 'README.md',
  mode: 'content',
})

Import Log

Import and show log files in Working Copy.

On-Demand
ts
import { importLog } from 'protocol-launcher/working-copy'

const url = importLog({
  lines: 'first line\nsecond line',
})

X-Callback-URL Commands

Checkout

Checkout (switch) branch in Working Copy.

On-Demand
ts
import { checkout } from 'protocol-launcher/working-copy'

const url = checkout({
  key: '123ABC',
  repo: 'my repo',
  branch: 'develop',
})

Commit

Commit changes in Working Copy.

On-Demand
ts
import { commit } from 'protocol-launcher/working-copy'

const url = commit({
  key: '123ABC',
  repo: 'my repo',
  path: '',
  limit: 999,
  message: 'fix',
})

Push

Push commits to remote repository.

On-Demand
ts
import { push } from 'protocol-launcher/working-copy'

const url = push({
  key: '123ABC',
  repo: 'my repo',
})

Pull

Pull (fetch and merge) from remote repository.

On-Demand
ts
import { pull } from 'protocol-launcher/working-copy'

const url = pull({
  key: '123ABC',
  repo: 'my repo',
})

Fetch

Fetch from remote repository.

On-Demand
ts
import { fetch } from 'protocol-launcher/working-copy'

const url = fetch({
  key: '123ABC',
  repo: 'my repo',
})

Status

List file status in Working Copy.

On-Demand
ts
import { status } from 'protocol-launcher/working-copy'

const url = status({
  key: '123ABC',
  repo: 'my repo',
  unchanged: true,
})

Log

Get commit log from Working Copy.

On-Demand
ts
import { log } from 'protocol-launcher/working-copy'

const url = log({
  key: '123ABC',
  repo: 'my repo',
})

Branches

List all local and remote branches in a repository.

On-Demand
ts
import { branches } from 'protocol-launcher/working-copy'

const url = branches({
  key: '123ABC',
  repo: 'my repo',
})

Merge

Merge branches in Working Copy.

On-Demand
ts
import { merge } from 'protocol-launcher/working-copy'

const url = merge({
  key: '123ABC',
  repo: 'my repo',
  branch: 'develop',
})

Delete Branch

Delete a branch in Working Copy.

On-Demand
ts
import { deleteBranch } from 'protocol-launcher/working-copy'

const url = deleteBranch({
  key: '123ABC',
  repo: 'my repo',
  branch: 'develop',
})

Init

Initialize a new empty repository.

On-Demand
ts
import { init } from 'protocol-launcher/working-copy'

const url = init({
  key: '123ABC',
  name: 'new repository',
})

Repos

List all repositories in Working Copy.

On-Demand
ts
import { repos } from 'protocol-launcher/working-copy'

const url = repos({
  key: '123ABC',
})

Move

Move or rename files within a repository.

On-Demand
ts
import { move } from 'protocol-launcher/working-copy'

const url = move({
  key: '123ABC',
  repo: 'my repo',
  source: 'from.txt',
  destination: 'to.txt',
})

Read

Read contents of text files from Working Copy.

On-Demand
ts
import { read } from 'protocol-launcher/working-copy'

const url = read({
  key: '123ABC',
  xSuccess: 'app://x-callback-url/read?text=',
  repo: 'my repo',
  path: 'README.md',
})

Write

Write to existing or new files in Working Copy.

On-Demand
ts
import { write } from 'protocol-launcher/working-copy'

const url = write({
  key: '123ABC',
  repo: 'my repo',
  path: 'README.md',
  text: 'hello there',
})

Zip

Archive multiple files as a base64-coded zip.

On-Demand
ts
import { zip } from 'protocol-launcher/working-copy'

const url = zip({
  key: '123ABC',
  xSuccess: 'my-app://x-callback-url/read?path=/',
  repo: 'my repo',
})

SSH Command

Run secure shell command on remote server.

On-Demand
ts
import { sshCommand } from 'protocol-launcher/working-copy'

const url = sshCommand({
  key: '123ABC',
  server: 'remote.server.net',
  cmd: 'run tests',
})

WebDAV

Start or stop the internal WebDAV server.

On-Demand
ts
import { webdav } from 'protocol-launcher/working-copy'

const url = webdav({
  key: '123ABC',
  cmd: 'start',
})

Chain

Chain multiple x-callback-url commands together.

On-Demand
ts
import { chain } from 'protocol-launcher/working-copy'

const url = chain({
  key: '123ABC',
  repo: 'my repo',
  commands: [
    { command: 'commit', params: { message: 'fix' } },
    { command: 'push' },
  ],
})