GIT-P4(1) GIT-P4(1) (NAME) git-p4 - Perforce (SYNOPSIS) git p4 clone [<->] [<->] <--p4>... git p4 sync [<->] [<--p4>...] git p4 rebase git p4 submit [<->] [<-->] (DESCRIPTION) p4 . git p4 clone (depot) p4 p4 . p4 git p4 sync . sync p4 . git p4 submit p4 . git p4 rebase sync (rebase) p4 . (EXAMPLES) o : $ git p4 clone //depot/path/project o : $ cd project $ vi foo.h $ git commit -a -m "edited foo.h" o p4 (rebase) : $ git p4 rebase o p4: $ git p4 submit (COMMANDS) (Clone) git p4 clone p4 : $ git p4 clone //depot/path/project : 1. project . 2. (head revision) p4 refs/remotes/p4/master . 3. master (checkout) . p4 @all : $ git p4 clone //depot/path/project@all (Sync) p4 : $ git p4 sync p4 . p4 git p4 sync : $ mkdir repo-git $ cd repo-git $ git init $ git p4 sync //path/in/your/perforce/depot refs/remotes/p4/master . --branch p4 . refs/remotes/origin/p4 git p4 sync . p4 . git p4 sync << >> (BRANCH DETECTION) . --branch . (Rebase) p4 (uncommitted) . p4 (rebase) . git p4 sync git rebase p4 . $ git p4 rebase (Submit) p4 (client workspace) p4 . P4CLIENT git-p4.client . p4 (client root) . p4/master : $ git p4 submit : $ git p4 submit topicbranch : $ git p4 submit --commit $ git p4 submit --commit (upstream reference) refs/remotes/p4/master --origin= . p4 git p4 submit . --preserve-user (author) . p4 p4 protect . (shelve / ) --shelve --update-shelve : $ git p4 submit --shelve $ git p4 submit --update-shelve 1234 --update-shelve 2345 (Unshelve) Unshelving (changelist) P4 refs/remotes/p4-unshelved/ . ( HEAD) . unshelve . "--origin" . refs/remotes/p4-unshelved . $ git p4 sync $ git p4 unshelve 12345 $ git show p4-unshelved/12345 $ git p4 unshelve 12345 (OPTIONS) (General options) clone . --git-dir GIT_DIR. git(1) . -v, --verbose . (Sync options) clone sync . --branch refs/remotes/p4/master. refs/ . p4/ . refs/ ( refs/remotes/) . --import-local . "master" . "p4/proj2" : $ git init $ git p4 sync --branch=refs/remotes/p4/proj2 //depot/proj2 --detect-branches p4. " (BRANCH DETECTION)" . --changesfile p4 file . git p4 p4 . --silent . --detect-labels p4 (labels) (tag) . changelist . . --import-labels p4 . --import-local p4 refs/remotes/p4/ git-branch(1) (remote-tracking) . p4 refs/heads/p4/ . --import-local p4 refs/heads . --max-changes n . @all --max-changes 1000 . --changes-block-size @all . p4 changes p4 changes -m . . --keep-path p4 . p4 . //depot/main/foo/bar.c //depot/main/ foo/bar.c . --keep-path depot/main/foo/bar.c . --use-client-spec (client spec) p4. " (CLIENT SPEC)" . -/ . (Clone options) clone sync . --destination . p4 . --bare (bare clone). git-clone(1) . (Submit options) git p4 submit . --origin p4 . p4 HEAD . -M . git-diff(1) . p4 move . . --preserve-user p4 p4. p4 . --export-labels p4. perforce . -n, --dry-run p4 p4 . --prepare-p4-only p4 p4 submit. "p4 submit" (revert) . () . p4 . --shelve (shelved changelists). shelve / (reverted/deleted) . shelve . --update-shelve CHANGELIST . --shelve . changelist . --conflict=(ask|skip|quit) p4 . ("ask") . . --branch p4/master. " (Sync options)" . --commit (|..) . --disable-rebase . git-p4.disableRebase . --disable-p4sync p4/master Perforce . --disable-rebase . git-p4.disableP4Sync . origin/master . (HOOKS FOR SUBMIT) p4-pre-submit p4-pre-submit . . git-p4 submit . --no-verify . (unit tests) . p4-prepare-changelist p4-prepare-changelist changelist . changelist . . (in place) --no-verify . --prepare-p4-only . p4-changelist p4-changelist changelist . --no-verify . changelist . . changelist . Submit . p4-post-changelist p4-post-changelist P4 . git p4 submit . (Rebase options) git p4 rebase . --import-labels p4. (Unshelve options) --origin refspec changelist P4 . p4/master . (DEPOT PATH SYNTAX) p4 git p4 sync git p4 clone p4 p4 : "//depot/my/project" #head . "//depot/my/project@all" . "//depot/my/project@1,6" . "//depot/proj1@all //depot/proj2@all" . . "proj1" "proj2" . --destination . . . p4 p4 help revisions . (CLIENT SPEC) p4 p4 client View . clone sync --use-client-spec useClientSpec true . git p4 clone useClientSpec . git p4 submit submit . view p4 p4 help views . git p4 view . (overlays) + - . (wildcards) git p4 ... . git p4 . . overlays git p4 . git p4 . git p4 . git-p4.client . p4 : P4CLIENT P4CONFIG (local host name). (BRANCH DETECTION) P4 . p4 . p4 branch . git p4 . --detect-branches git p4 p4 . P4 : //depot/main/... //depot/branch1/... "p4 branch -o branch1" View : //depot/main/... //depot/branch1/... git p4 clone: git p4 clone --detect-branches //depot@all refs/remotes/p4/ //depot/main master //depot/branch1 depot/branch1 . p4 . git-p4.branchList . "source:destination" p4 "source" "destination" p4 . p4 . p4 : git init depot cd depot git config git-p4.branchList main:branch1 git p4 clone --detect-branches //depot@all . (PERFORMANCE) fast-import git p4 git p4 sync pack file . (git-gc(1)) git repack -adf . (CONFIGURATION VARIABLES) git p4 . git-p4 . (General variables) git-p4.user p4 -u . P4USER . git-p4.password p4 -P . P4PASS . git-p4.port () p4 -p . P4PORT . git-p4.host p4 -h . P4HOST . git-p4.client p4 -c . git-p4.retries p4 ( p4 sync) . . p4 ( 2012.2) 0 . (Clone and sync variables) git-p4.syncFromOrigin p4 p4 . refs/remote/origin/p4 p4 . false . git-p4.branchUser p4 . . . git-p4.branchList . (:) . branchA branchB main : git config git-p4.branchList main:branchA git config --add git-p4.branchList main:branchB git-p4.ignoredP4Labels p4 . . git-p4.importLabels p4 --import-labels. git-p4.labelImportRegexp p4 . [a-zA-Z0-9_\-.]+$. git-p4.useClientSpec p4 p4 . --use-client-spec . " (CLIENT SPEC)" . p4. git-p4.pathEncoding Perforce . UTF-8 . git-p4 Perforce . UTF-8 . Perforce "cp1252" . p4 clone . git-p4.metadataDecodingStrategy Perforce changelist . p4v changelist . / utf-8 . git-p4 Perforce : passthrough Perforce Perforce utf-8 . strict Perforce utf-8 . fallback utf-8 - cp-1252 - . passthrough fallback . strict . p4 clone . git-p4.metadataFallbackEncoding (fallback) changelist Perforce fallback ( git-p4.metadataDecodingStrategy). utf-8 . cp1252 . p4 clone . git-p4.largeFileSystem () . git p4 submit . Git LFS ( https://git-lfs.github.com ). Git LFS : git config git-p4.largeFileSystem GitLFS git-p4.largeFileExtensions . . . git-p4.largeFileThreshold . . k m g . git-p4.largeFileCompressedThreshold . / . . k m g . git-p4.largeFilePush (push) . git-p4.keepEmptyCommits true changelist . git-p4.mapUser P4 . : git config --add git-p4.mapUser "p4user = First Last " P4 . P4 . (Submit variables) git-p4.detectRenames . git-diff(1) . true false git diff -M . git-p4.detectCopies . git- diff(1) . true false git diff -C . git-p4.detectCopiesHarder . git-diff(1) . . git-p4.preserveUser git p4 submit . git-p4.allowMissingP4Users preserveUser true git p4 p4 . . git-p4.skipSubmitEdit submit p4 . true . git-p4.skipSubmitEditCheck p4 git p4 . . git-p4.allowSubmit git p4 submit . . ( "refs/heads/") (",") . git-p4.skipUserNameCheck git p4 submit p4 git p4 . . git-p4.attemptRCSCleanup git p4 submit RCS ($Header$ ) . . . git-p4.exportLabels p4 --export-labels. git-p4.labelExportRegexp p4 . [a-zA-Z0-9_\-.]+$. git-p4.conflict submit p4 --conflict. ask. git-p4.disableRebase p4/master . git-p4.disableP4Sync p4/master Perforce . git-p4.disableRebase . origin/master . (IMPLEMENTATION DETAILS) o (changesets) p4 Git fast-import . o p4 p4 print . o (Submit) p4 . (patches) p4 . o git p4 p4 . git p4 sync p4 . (SEE ALSO) git(1), git-branch(1), git-clone(1), git-diff(1) (GIT) git(1) Git 2.55.0 2026-06-29 GIT-P4(1)