You create a Workspace View. It maps a workspace
to one or several Perforce depots
, folders and files.
With Git, there is no special setup, you can just clone
one single and entire project repository
. Project files are stored in your working directory
.
$ git clone <repository URL>
Perforce is a centralized version control system. It means the system database, known as the Perforce depot
, is only stored on a central server.
You have local copy of the files you need, but unlike Git you don't have a local copy of the depots
.
Most of the Perforce operations are performed on the server, against that remote depots. It means you can't really work offline, unless you use external tools like Perforce Sandbox.
To update your workspace
:
$ p4 sync (aka "Get Latest Revision")
REMINDER
Checked-out files (ie. opened in a changelist) are not updated.
Perfoce, like SVN, uses a central repo (image source: atlassian.com)
On the other side, Git is a distributed version control system (DVCS). All the version control information is stored in a .git
folder. It makes no difference between your local repository and the remote one you cloned. They both hold this .git
folder.
It's up to the team to define one repo as a "reference", for example defining a repo hosted Github as the central one.
As a consequence, most of the Git operations are performed locally. You can work offline.
Fetch a repository to feed your local .git
with the latest updates information:
$ git fetch <repository>
The .git
folder is updated but your project files remain unchanged. To actually update your project files to another version, you checkout
a branch or a commit:
$ git checkout <branch|commit>
WARNING
Git checkout is not Perforce checkout. The former is about moving from a version to another, the latter is about opening a file in a changelist.
In the chapter 5 and the next courses you'll learn about merging your work with remote changes. Git provides a shortcut for fetching
and merging
(or preferably rebasing
when using the proper argument or setting) at the same time:
$ git pull
- perforce
workspace view
setup vs gitclone
centralized
vsdistributed
version control system- perforce
workspace
vs gitworking directory
- perforce
depot
vs gitrepository
- perforce
Get Latest Revision
(sync
) vs gitfetch
,checkout
andpull
- perforce
checkout
is NOT gitcheckout