Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have been using Git for a long time and before that Subversion. Now I am faced with a client that hosts their sources in Perforce.

Its been troublesome and I do not feel I have a handle on things. What is a good tutorial or explanation of Perforce for Git and SVN developers?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I would definitely use git-p4 to directly interface Git with the Perforce repository. At the most basic level, this adds two new commands, git p4 rebase and git p4 submit that handle the mechanics of fetching and pushing to Perforce repositories. Once you have your repo in Git, you can use all the good features you're accustomed to such as lightweight local branching.

When cloning for the first time (git p4 clone), I had trouble using the @all revspec to get the entire repository history. I don't know whether this was specific to the Perforce server I was using, or whether it's a wider problem, but if the first clone hangs then try it without @all to just start with the current revision.

You can find the git-p4 script in contrib/fast-import in the Git source distribution.

share|improve this answer
Is it possible to use git over an existing p4 repo? The client has a hude codebase & the p4 checkout is managed via their internal scripts. –  Ivo Jan 14 '11 at 3:28
@Ivo: The way git-p4 works is you set up a regular Perforce client using the p4 client command as usual. Then, you use git p4 clone to make a copy of that in another directory, which will be a Git repository with a working copy that is separate from your Perforce client. You should be able to continue to use the client's p4 scripts. –  Greg Hewgill Jan 14 '11 at 8:09
add comment

When I was looking into Perforce (didn't end up using it - so no direct experience) I read through this O'Reilly book:

The Perforce sales guy was kind enough to send me a copy. He said it was written by one of the founders of the company or something like that. I found it to be a good introduction to the tool. But like I said we didn't end up purchasing so I can't say the book actually was good as a practical reference.

share|improve this answer
It's an excellent book, which I highly recommend as an introduction to a lot of version control concepts in general, not just Perforce. It's less useful as a day-to-day reference than the P4 documentation, though. –  ebneter Jan 27 '11 at 0:36
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.