8080
8181 To reproduce the entire p4 history in Git, use the '@all' modifier on
8282the depot path:
83+
8384------------
8485$ git p4 clone //depot/path/project@all
8586------------
8990~~~~
9091As development continues in the p4 repository, those changes can
9192be included in the Git repository using:
93+
9294------------
9395$ git p4 sync
9496------------
97+
9598This command finds new changes in p4 and imports them as Git commits.
9699
97100P4 repositories can be added to an existing Git repository using
98101'git p4 sync' too:
102+
99103------------
100104$ mkdir repo-git
101105$ cd repo-git
102106$ git init
103107$ git p4 sync //path/in/your/perforce/depot
104108------------
109+
105110This imports the specified depot into
106111'refs/remotes/p4/master' in an existing Git repository. The
107112`--branch` option can be used to specify a different branch to
@@ -125,6 +130,7 @@ and merge them with local uncommitted changes. Often, the p4 repository
125130is the ultimate location for all code, thus a rebase workflow makes
126131sense. This command does 'git p4 sync' followed by 'git rebase' to move
127132local commits on top of updated p4 changes.
133+
128134------------
129135$ git p4 rebase
130136------------
@@ -140,16 +146,19 @@ will be created and populated if it does not already exist.
140146
141147To submit all changes that are in the current Git branch but not in
142148the 'p4/master' branch, use:
149+
143150------------
144151$ git p4 submit
145152------------
146153
147154To specify a branch other than the current one, use:
155+
148156------------
149157$ git p4 submit topicbranch
150158------------
151159
152160To specify a single commit or a range of commits, use:
161+
153162------------
154163$ git p4 submit --commit <sha1>
155164$ git p4 submit --commit <sha1..sha1>
@@ -510,20 +519,24 @@ when cloning or syncing to have 'git p4' automatically find
510519subdirectories in p4, and to generate these as branches in Git.
511520
512521For example, if the P4 repository structure is:
522+
513523----
514524//depot/main/...
515525//depot/branch1/...
516526----
517527
518528And "p4 branch -o branch1" shows a View line that looks like:
529+
519530----
520531//depot/main/... //depot/branch1/...
521532----
522533
523534Then this 'git p4 clone' command:
535+
524536----
525537git p4 clone --detect-branches //depot@all
526538----
539+
527540produces a separate branch in 'refs/remotes/p4/' for //depot/main,
528541called 'master', and one for //depot/branch1 called 'depot/branch1'.
529542
@@ -536,6 +549,7 @@ simple p4 branch specification, where the "source" and "destination" are
536549the path elements in the p4 repository. The example above relied on the
537550presence of the p4 branch. Without p4 branches, the same result will
538551occur with:
552+
539553----
540554git init depot
541555cd depot
0 commit comments