Skip to content

Commit

Permalink
Clean up the git-p4 documentation
Browse files Browse the repository at this point in the history
This patch massages the documentation a bit for improved readability and cleans
it up from outdated options/commands.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
tronical authored and gitster committed Aug 24, 2008
1 parent 7d77016 commit f5f7e4a
Showing 1 changed file with 38 additions and 31 deletions.
69 changes: 38 additions & 31 deletions contrib/fast-import/git-p4.txt
Expand Up @@ -3,26 +3,35 @@ git-p4 - Perforce <-> Git converter using git-fast-import
Usage
=====

git-p4 supports two main modes: Importing from Perforce to a Git repository is
done using "git-p4 sync" or "git-p4 rebase". Submitting changes from Git back
to Perforce is done using "git-p4 submit".
git-p4 can be used in two different ways:

1) To import changes from Perforce to a Git repository, using "git-p4 sync".

2) To submit changes from Git back to Perforce, using "git-p4 submit".

Importing
=========

You can simply start with
Simply start with

git-p4 clone //depot/path/project

or

git-p4 clone //depot/path/project myproject

This will create an empty git repository in a subdirectory called "project" (or
"myproject" with the second command), import the head revision from the
specified perforce path into a git "p4" branch (remotes/p4 actually), create a
master branch off it and check it out. If you want the entire history (not just
the head revision) then you can simply append a "@all" to the depot path:
This will:

1) Create an empty git repository in a subdirectory called "project" (or
"myproject" with the second command)

2) Import the head revision from the given Perforce path into a git branch
called "p4" (remotes/p4 actually)

3) Create a master branch based on it and check it out.

If you want the entire history (not just the head revision) then you can simply
append a "@all" to the depot path:

git-p4 clone //depot/project/main@all myproject

Expand All @@ -37,31 +46,40 @@ If you want more control you can also use the git-p4 sync command directly:

This will import the current head revision of the specified depot path into a
"remotes/p4/master" branch of your git repository. You can use the
--branch=mybranch option to use a different branch.
--branch=mybranch option to import into a different branch.

If you want to import the entire history of a given depot path just use
If you want to import the entire history of a given depot path simply use:

git-p4 sync //path/in/depot@all


Note:

To achieve optimal compression you may want to run 'git repack -a -d -f' after
a big import. This may take a while.

Support for Perforce integrations is still work in progress. Don't bother
trying it unless you want to hack on it :)

Incremental Imports
===================

After an initial import you can easily synchronize your git repository with
newer changes from the Perforce depot by just calling
After an initial import you can continue to synchronize your git repository
with newer changes from the Perforce depot by just calling

git-p4 sync

in your git repository. By default the "remotes/p4/master" branch is updated.

It is recommended to run 'git repack -a -d -f' from time to time when using
incremental imports to optimally combine the individual git packs that each
incremental import creates through the use of git-fast-import.
Advanced Setup
==============

Suppose you have a periodically updated git repository somewhere, containing a
complete import of a Perforce project. This repository can be cloned and used
with git-p4. When updating the cloned repository with the "sync" command,
git-p4 will try to fetch changes from the original repository first. The git
protocol used with this is usually faster than importing from Perforce
directly.

This behaviour can be disabled by setting the "git-p4.syncFromOrigin" git
configuration variable to "false".

Updating
========
Expand All @@ -79,7 +97,7 @@ Submitting
==========

git-p4 has support for submitting changes from a git repository back to the
Perforce depot. This requires a Perforce checkout separate to your git
Perforce depot. This requires a Perforce checkout separate from your git
repository. To submit all changes that are in the current git branch but not in
the "p4" branch (or "origin" if "p4" doesn't exist) simply call

Expand All @@ -97,17 +115,6 @@ continue importing the remaining changes with

git-p4 submit --continue

After submitting you should sync your perforce import branch ("p4" or "origin")
from Perforce using git-p4's sync command.

If you have changes in your working directory that you haven't committed into
git yet but that you want to commit to Perforce directly ("quick fixes") then
you do not have to go through the intermediate step of creating a git commit
first but you can just call

git-p4 submit --direct


Example
=======

Expand Down

0 comments on commit f5f7e4a

Please sign in to comment.