Scribe for Git and Perforce users
Dokumentace/Začněte zde
Scribe for Git and Perforce users8 min čtení

Scribe for Git and Perforce users

Zdrojová dokumentace je zatím dostupná v angličtině. Ovládání čtečky odpovídá zvolenému jazyku.

Na této stránce

Use this page to translate familiar workflows into Scribe commands. The tables compare everyday use cases, not interchangeable commands. Perforce examples use the centralized P4 workflow; depot paths, client views, and stream setup depend on your team's configuration.

Concepts first

ConceptScribeGitPerforce (P4)
Accepted historyAuthoritative server repositoryLocal commits; pushing shares them with a remoteSubmitted changelists on the server
Local working copyWorkspace for one repository and branchWorking tree backed by a local repositoryClient workspace mapping depot files to local paths
Select local contentWorkspace view: included file/directory prefixesSparse checkout selects working-tree contentClient view or stream view controls mapped content
Shared selection presetNamed profile in .scribe/config.tomlNo direct named-profile equivalent in sparse checkoutClient templates or stream configuration can share mappings; different semantics
Prepare a changeOpen files with edit, add, delete, or moveStage content in the index with git add and related commandsOpen files in a pending changelist
Publish prepared worksubmit publishes opened file changes together as one changesetcommit records locally; push publishes commitssubmit publishes a changelist
Pinned dependency repositoryVersioned repository mountSubmodule records a child commitStream imports can select depot content at a revision; not a separate Git-style repository
Coordinate dependenciesproject commands manage parent and selected mounted workspacesSubmodule commands plus commits/pushes in child and parentDepends on depot/stream layout and team tooling

A Scribe workspace can contain the whole repository or a partial view. A profile is a named preset for that view. Applying a profile saves its resolved selection; later profile edits take effect only when explicitly reapplied. Views and profiles do not grant or restrict repository permissions.

Git's index saves staged content. Scribe records opened intent and prepares the opened files' content when submitting; scribe add is for new files, not a Git-like way to stage the latest edits to tracked files.

See the official Git tutorial, sparse-checkout reference, submodule guide, and P4 client reference for the corresponding models.

Everyday commands

Run Scribe file commands inside the workspace that owns the files. FILE, URL, and other uppercase words below are placeholders. Commands separated by “then” are separate steps.

Use caseScribeGitPerforce (P4)
Get a working copyscribe workspace create Game ./Game, then inside it scribe syncgit clone URL GameConfigure p4 client, then p4 sync
Start editing a tracked filescribe edit FILE, then editEdit directly; stage afterward with git add FILEp4 edit FILE, then edit
Add a new filescribe add FILEgit add FILEp4 add FILE
Move a tracked filescribe move OLD NEWgit mv OLD NEWOpen for edit if needed, then p4 move OLD NEW
Delete a tracked filescribe delete FILEgit rm FILEp4 delete FILE
Inspect pending workscribe statusgit statusp4 opened
Discover edits made outside the workflowscribe status --scan (also scribe scan)git statusp4 reconcile -n previews discovered changes
Prepare discovered tracked editsscribe reconcile --scan; add/delete reported paths explicitlygit add FILE for intended changesp4 reconcile opens discovered adds, edits, and deletes
Publish prepared workscribe submit -m "Fix"git commit -m "Fix", then git pushp4 submit -d "Fix" for the default changelist
Publish selected filesscribe submit -m "Fix" -- FILE1 FILE2 selects exact opened filesStage intended content, then commit and pushPut intended files in a numbered changelist, then p4 submit -c NUMBER
Get newer accepted workscribe syncgit pull --ff-only when the branch can fast-forward; divergence needs integrationp4 sync; opened files may require resolve
Undo an unsubmitted file editscribe revert FILEFor an unstaged edit: git restore FILEp4 revert FILE
Inspect historyscribe log or scribe log FILEgit log or git log -- FILEp4 changes or p4 filelog FILE
Explain ignore rulesscribe ignore explain FILEgit check-ignore -v FILEp4 ignores -v FILE

scribe status emphasizes opened work; use --scan to discover unopened changes. Scribe's scan reports without opening files. reconcile --scan opens discovered tracked edits, but does not automatically add untracked files or open missing files for deletion. P4's mutating reconciliation covers those cases too; see p4 reconcile.

scribe submit needs the server: there is no separate local commit and later push. By default, all opened file changes in the workspace are published together as one changeset in its repository, with one revision number and message. A changeset can contain multiple file edits, additions, deletions, and moves; “one changeset” does not mean one changed file. This is closest to p4 submit.

To submit a subset, pass exact opened file paths after --; other work stays opened. This selects files, not staged snapshots or individual hunks. Move groups remain complete, and active integration/conflict workflows require a full submit. See submit options for selection and retry rules.

scribe revert restores workspace-base content and preserves the replaced tracked content in .scribe/_state/recovery, modified or not. It does not create an inverse history commit like git revert. Do not assume Git or P4 discard commands provide Scribe's recovery behavior.

Branches, selections, and locks

Use caseScribeGitPerforce (P4)
Create a branchscribe branch create featuregit branch featureCreate/populate a stream or branch files according to depot layout
Switch branchesscribe switch featuregit switch featureSwitch/configure the client stream and sync
Merge into the current branchscribe merge feature, resolve, then submitgit merge feature, resolve if needed, then complete the commit and pushIntegrate/merge source to target, p4 resolve, then p4 submit
Apply one source changescribe cherry-pick CHANGE --from feature, resolve, then submitgit cherry-pick COMMIT, then pushIntegrate the selected source revision range, resolve, then submit
Select source folders locallyscribe workspace view set --view Source --view Configgit sparse-checkout set Source ConfigEdit the client/stream view, then sync
Apply a shared view presetscribe workspace view set --profile programmerNo direct equivalentUse your team's client/stream configuration
Include the entire repositoryscribe workspace view set --allgit sparse-checkout disableMap the required depot paths and sync
Reserve a file for exclusive workscribe lock acquire FILE; required locks are also acquired by editNo core Git file-lock commandExclusive-open file type +l; p4 lock separately prevents other submissions

Scribe switching requires no opened files, pending submit, or held locks. Scribe has no branch deletion, rebase, or history rewrite. Its locks span branches within the repository. P4's lock has different semantics: see the P4 lock reference. For P4 branch integration, see p4 integrate.

Scribe view changes reconcile immediately and preserve displaced tracked files in recovery, so shrinking an existing view may not immediately free disk space. Selecting a view before the initial sync avoids downloading excluded content. Git sparse checkout controls the working tree; reducing transferred repository objects is a separate partial-clone concern.

Example: Game needs a new Engine feature

Assume Game declares a mount named engine at Engine, and both workspaces are already synced:

text
Game/                      Game repository workspace
├── .scribe/config.toml    Records the Engine revision pin
├── Source/Game.cpp        Owned by Game
└── Engine/                Engine repository workspace
    └── Source/Engine.cpp  Owned by Engine

Open the files in their owning workspaces, then edit them:

sh
cd Game
scribe edit Source/Game.cpp
cd Engine
scribe edit Source/Engine.cpp
# Edit both files in your editor.
cd ..
scribe project status --scan
scribe project publish -m "Add Engine support and use it in Game"
ActionScribeGit with an Engine submodulePerforce (P4)
Publish Engine workProject publication submits the Engine workspaceCommit and push inside EngineSubmit the Engine files/changelist
Record the dependencyPublication updates Game's Engine pinStage the changed Engine submodule pointer in GameUpdate the dependency pin/import configuration if your layout uses one
Publish Game workPublication submits Game changes and the pin togetherCommit and push Game changes with the pointerSubmit Game changes; composition depends on stream/depot setup
Retrieve the matching combinationscribe project sync (ordinary parent scribe sync also handles mounts)Update Game, then git submodule update --init --recursiveSync the configured client/stream and pinned imports

In Scribe this creates separate accepted changesets in Engine and Game. Acceptance is atomic per repository. If Game's submission fails after Engine succeeds, the Engine change remains accepted; scribe project publish --continue resumes the saved publication when the interruption can be retried. A rejected submission may require aborting the publication, resolving the rejection, and publishing again.

You can perform the same work manually: submit inside Engine, return to Game, run scribe project update engine, and submit Game. Running ordinary scribe submit from Game only submits Game's opened files; it does not collect Engine's edits. Submitting inside Engine does not itself advance Game's pin. Project publication coordinates these steps and records progress for recovery.

P4 can map Game and Engine depot paths into one client and submit them together when the server and workspace layout allow it. That differs from Scribe's separate repository mount model; a P4 directory is not necessarily a repository boundary. Stream import and specification behavior is documented in the P4 stream reference.

Continue learning

Zdroj docs/scribe-git-perforce.mdVerze 2b8dcccb