Linux command
git-p4 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Clone from Perforce
git p4 clone //depot/path@all
Clone into a specific directory
git p4 clone //depot/path@all [directory]
Sync latest changes
git p4 sync
Submit git commits
git p4 submit
Rebase current branch
git p4 rebase
Clone with branch detection
git p4 clone --detect-branches //depot/path@all
说明
git p4 enables bidirectional interaction between Git and Perforce. It can import Perforce depot history into a Git repository and submit Git commits back to Perforce, supporting both migration and ongoing hybrid workflows. The tool maps Perforce depot paths to Git branches, allowing teams to work with Git locally while maintaining synchronization with a Perforce server. It supports gradual migration from Perforce to Git as well as permanent dual-system setups. The clone command creates a new Git repo from Perforce. sync fetches new changes without modifying working files. rebase syncs and rebases the current branch. submit sends Git commits to Perforce as individual changelists.
参数
- clone _DEPOT_
- Import from Perforce depot.
- sync
- Fetch changes from Perforce.
- submit
- Submit git commits to Perforce.
- rebase
- Rebase on Perforce changes.
- --branch _BRANCH_
- Target branch.
- --detect-branches
- Auto-detect Perforce branch mappings.
- --bare
- Perform a bare clone (no working directory).
- --use-client-spec
- Use the Perforce client spec for file filtering.
- --origin _ref_
- Upstream location from which commits are identified to submit (default: most recent p4 commit reachable from HEAD).
- --shelve
- Create shelved changelists instead of submitting.
- --conflict _(ask|skip|quit)_
- Conflict handling during submit (default: ask).
- --verbose
- Provide more detailed output.
- --help
- Display help information.
FAQ
What is the git-p4 command used for?
git p4 enables bidirectional interaction between Git and Perforce. It can import Perforce depot history into a Git repository and submit Git commits back to Perforce, supporting both migration and ongoing hybrid workflows. The tool maps Perforce depot paths to Git branches, allowing teams to work with Git locally while maintaining synchronization with a Perforce server. It supports gradual migration from Perforce to Git as well as permanent dual-system setups. The clone command creates a new Git repo from Perforce. sync fetches new changes without modifying working files. rebase syncs and rebases the current branch. submit sends Git commits to Perforce as individual changelists.
How do I run a basic git-p4 example?
Run `git p4 clone //depot/path@all` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does clone _DEPOT_ do in git-p4?
Import from Perforce depot.