Autogenerated HTML docs for v2.45.1-204-gd8ab1
[git-htmldocs.git] / git-p4.html
blobed16cfbd74029f8193bd4436e3f6787a8b79e179
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-p4(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-p4(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-p4 -
743 Import from and submit to Perforce repositories
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git p4 clone</em> [&lt;sync-options&gt;] [&lt;clone-options&gt;] &lt;p4-depot-path&gt;&#8230;
753 <em>git p4 sync</em> [&lt;sync-options&gt;] [&lt;p4-depot-path&gt;&#8230;]
754 <em>git p4 rebase</em>
755 <em>git p4 submit</em> [&lt;submit-options&gt;] [&lt;master-branch-name&gt;]</pre>
756 <div class="attribution">
757 </div></div>
758 </div>
759 </div>
760 <div class="sect1">
761 <h2 id="_description">DESCRIPTION</h2>
762 <div class="sectionbody">
763 <div class="paragraph"><p>This command provides a way to interact with p4 repositories
764 using Git.</p></div>
765 <div class="paragraph"><p>Create a new Git repository from an existing p4 repository using
766 <em>git p4 clone</em>, giving it one or more p4 depot paths. Incorporate
767 new commits from p4 changes with <em>git p4 sync</em>. The <em>sync</em> command
768 is also used to include new branches from other p4 depot paths.
769 Submit Git changes back to p4 using <em>git p4 submit</em>. The command
770 <em>git p4 rebase</em> does a sync plus rebases the current branch onto
771 the updated p4 remote branch.</p></div>
772 </div>
773 </div>
774 <div class="sect1">
775 <h2 id="_examples">EXAMPLES</h2>
776 <div class="sectionbody">
777 <div class="ulist"><ul>
778 <li>
780 Clone a repository:
781 </p>
782 <div class="listingblock">
783 <div class="content">
784 <pre><code>$ git p4 clone //depot/path/project</code></pre>
785 </div></div>
786 </li>
787 <li>
789 Do some work in the newly created Git repository:
790 </p>
791 <div class="listingblock">
792 <div class="content">
793 <pre><code>$ cd project
794 $ vi foo.h
795 $ git commit -a -m "edited foo.h"</code></pre>
796 </div></div>
797 </li>
798 <li>
800 Update the Git repository with recent changes from p4, rebasing your
801 work on top:
802 </p>
803 <div class="listingblock">
804 <div class="content">
805 <pre><code>$ git p4 rebase</code></pre>
806 </div></div>
807 </li>
808 <li>
810 Submit your commits back to p4:
811 </p>
812 <div class="listingblock">
813 <div class="content">
814 <pre><code>$ git p4 submit</code></pre>
815 </div></div>
816 </li>
817 </ul></div>
818 </div>
819 </div>
820 <div class="sect1">
821 <h2 id="_commands">COMMANDS</h2>
822 <div class="sectionbody">
823 <div class="sect2">
824 <h3 id="_clone">Clone</h3>
825 <div class="paragraph"><p>Generally, <em>git p4 clone</em> is used to create a new Git directory
826 from an existing p4 repository:</p></div>
827 <div class="listingblock">
828 <div class="content">
829 <pre><code>$ git p4 clone //depot/path/project</code></pre>
830 </div></div>
831 <div class="paragraph"><p>This:</p></div>
832 <div class="olist arabic"><ol class="arabic">
833 <li>
835 Creates an empty Git repository in a subdirectory called <em>project</em>.
836 </p>
837 </li>
838 <li>
840 Imports the full contents of the head revision from the given p4
841 depot path into a single commit in the Git branch <em>refs/remotes/p4/master</em>.
842 </p>
843 </li>
844 <li>
846 Creates a local branch, <em>master</em> from this remote and checks it out.
847 </p>
848 </li>
849 </ol></div>
850 <div class="paragraph"><p>To reproduce the entire p4 history in Git, use the <em>@all</em> modifier on
851 the depot path:</p></div>
852 <div class="listingblock">
853 <div class="content">
854 <pre><code>$ git p4 clone //depot/path/project@all</code></pre>
855 </div></div>
856 </div>
857 <div class="sect2">
858 <h3 id="_sync">Sync</h3>
859 <div class="paragraph"><p>As development continues in the p4 repository, those changes can
860 be included in the Git repository using:</p></div>
861 <div class="listingblock">
862 <div class="content">
863 <pre><code>$ git p4 sync</code></pre>
864 </div></div>
865 <div class="paragraph"><p>This command finds new changes in p4 and imports them as Git commits.</p></div>
866 <div class="paragraph"><p>P4 repositories can be added to an existing Git repository using
867 <em>git p4 sync</em> too:</p></div>
868 <div class="listingblock">
869 <div class="content">
870 <pre><code>$ mkdir repo-git
871 $ cd repo-git
872 $ git init
873 $ git p4 sync //path/in/your/perforce/depot</code></pre>
874 </div></div>
875 <div class="paragraph"><p>This imports the specified depot into
876 <em>refs/remotes/p4/master</em> in an existing Git repository. The
877 <code>--branch</code> option can be used to specify a different branch to
878 be used for the p4 content.</p></div>
879 <div class="paragraph"><p>If a Git repository includes branches <em>refs/remotes/origin/p4</em>, these
880 will be fetched and consulted first during a <em>git p4 sync</em>. Since
881 importing directly from p4 is considerably slower than pulling changes
882 from a Git remote, this can be useful in a multi-developer environment.</p></div>
883 <div class="paragraph"><p>If there are multiple branches, doing <em>git p4 sync</em> will automatically
884 use the "BRANCH DETECTION" algorithm to try to partition new changes
885 into the right branch. This can be overridden with the <code>--branch</code>
886 option to specify just a single branch to update.</p></div>
887 </div>
888 <div class="sect2">
889 <h3 id="_rebase">Rebase</h3>
890 <div class="paragraph"><p>A common working pattern is to fetch the latest changes from the p4 depot
891 and merge them with local uncommitted changes. Often, the p4 repository
892 is the ultimate location for all code, thus a rebase workflow makes
893 sense. This command does <em>git p4 sync</em> followed by <em>git rebase</em> to move
894 local commits on top of updated p4 changes.</p></div>
895 <div class="listingblock">
896 <div class="content">
897 <pre><code>$ git p4 rebase</code></pre>
898 </div></div>
899 </div>
900 <div class="sect2">
901 <h3 id="_submit">Submit</h3>
902 <div class="paragraph"><p>Submitting changes from a Git repository back to the p4 repository
903 requires a separate p4 client workspace. This should be specified
904 using the <code>P4CLIENT</code> environment variable or the Git configuration
905 variable <em>git-p4.client</em>. The p4 client must exist, but the client root
906 will be created and populated if it does not already exist.</p></div>
907 <div class="paragraph"><p>To submit all changes that are in the current Git branch but not in
908 the <em>p4/master</em> branch, use:</p></div>
909 <div class="listingblock">
910 <div class="content">
911 <pre><code>$ git p4 submit</code></pre>
912 </div></div>
913 <div class="paragraph"><p>To specify a branch other than the current one, use:</p></div>
914 <div class="listingblock">
915 <div class="content">
916 <pre><code>$ git p4 submit topicbranch</code></pre>
917 </div></div>
918 <div class="paragraph"><p>To specify a single commit or a range of commits, use:</p></div>
919 <div class="listingblock">
920 <div class="content">
921 <pre><code>$ git p4 submit --commit &lt;sha1&gt;
922 $ git p4 submit --commit &lt;sha1..sha1&gt;</code></pre>
923 </div></div>
924 <div class="paragraph"><p>The upstream reference is generally <em>refs/remotes/p4/master</em>, but can
925 be overridden using the <code>--origin=</code> command-line option.</p></div>
926 <div class="paragraph"><p>The p4 changes will be created as the user invoking <em>git p4 submit</em>. The
927 <code>--preserve-user</code> option will cause ownership to be modified
928 according to the author of the Git commit. This option requires admin
929 privileges in p4, which can be granted using <em>p4 protect</em>.</p></div>
930 <div class="paragraph"><p>To shelve changes instead of submitting, use <code>--shelve</code> and <code>--update-shelve</code>:</p></div>
931 <div class="listingblock">
932 <div class="content">
933 <pre><code>$ git p4 submit --shelve
934 $ git p4 submit --update-shelve 1234 --update-shelve 2345</code></pre>
935 </div></div>
936 </div>
937 <div class="sect2">
938 <h3 id="_unshelve">Unshelve</h3>
939 <div class="paragraph"><p>Unshelving will take a shelved P4 changelist, and produce the equivalent git commit
940 in the branch refs/remotes/p4-unshelved/&lt;changelist&gt;.</p></div>
941 <div class="paragraph"><p>The git commit is created relative to the current origin revision (HEAD by default).
942 A parent commit is created based on the origin, and then the unshelve commit is
943 created based on that.</p></div>
944 <div class="paragraph"><p>The origin revision can be changed with the "--origin" option.</p></div>
945 <div class="paragraph"><p>If the target branch in refs/remotes/p4-unshelved already exists, the old one will
946 be renamed.</p></div>
947 <div class="listingblock">
948 <div class="content">
949 <pre><code>$ git p4 sync
950 $ git p4 unshelve 12345
951 $ git show p4-unshelved/12345
952 &lt;submit more changes via p4 to the same files&gt;
953 $ git p4 unshelve 12345
954 &lt;refuses to unshelve until git is in sync with p4 again&gt;</code></pre>
955 </div></div>
956 </div>
957 </div>
958 </div>
959 <div class="sect1">
960 <h2 id="_options">OPTIONS</h2>
961 <div class="sectionbody">
962 <div class="sect2">
963 <h3 id="_general_options">General options</h3>
964 <div class="paragraph"><p>All commands except clone accept these options.</p></div>
965 <div class="dlist"><dl>
966 <dt class="hdlist1">
967 --git-dir &lt;dir&gt;
968 </dt>
969 <dd>
971 Set the <code>GIT_DIR</code> environment variable. See <a href="git.html">git(1)</a>.
972 </p>
973 </dd>
974 <dt class="hdlist1">
976 </dt>
977 <dt class="hdlist1">
978 --verbose
979 </dt>
980 <dd>
982 Provide more progress information.
983 </p>
984 </dd>
985 </dl></div>
986 </div>
987 <div class="sect2">
988 <h3 id="_sync_options">Sync options</h3>
989 <div class="paragraph"><p>These options can be used in the initial <em>clone</em> as well as in
990 subsequent <em>sync</em> operations.</p></div>
991 <div class="dlist"><dl>
992 <dt class="hdlist1">
993 --branch &lt;ref&gt;
994 </dt>
995 <dd>
997 Import changes into &lt;ref&gt; instead of refs/remotes/p4/master.
998 If &lt;ref&gt; starts with refs/, it is used as is. Otherwise, if
999 it does not start with p4/, that prefix is added.
1000 </p>
1001 <div class="paragraph"><p>By default a &lt;ref&gt; not starting with refs/ is treated as the
1002 name of a remote-tracking branch (under refs/remotes/). This
1003 behavior can be modified using the --import-local option.</p></div>
1004 <div class="paragraph"><p>The default &lt;ref&gt; is "master".</p></div>
1005 <div class="paragraph"><p>This example imports a new remote "p4/proj2" into an existing
1006 Git repository:</p></div>
1007 <div class="listingblock">
1008 <div class="content">
1009 <pre><code> $ git init
1010 $ git p4 sync --branch=refs/remotes/p4/proj2 //depot/proj2</code></pre>
1011 </div></div>
1012 </dd>
1013 <dt class="hdlist1">
1014 --detect-branches
1015 </dt>
1016 <dd>
1018 Use the branch detection algorithm to find new paths in p4. It is
1019 documented below in "BRANCH DETECTION".
1020 </p>
1021 </dd>
1022 <dt class="hdlist1">
1023 --changesfile &lt;file&gt;
1024 </dt>
1025 <dd>
1027 Import exactly the p4 change numbers listed in <em>file</em>, one per
1028 line. Normally, <em>git p4</em> inspects the current p4 repository
1029 state and detects the changes it should import.
1030 </p>
1031 </dd>
1032 <dt class="hdlist1">
1033 --silent
1034 </dt>
1035 <dd>
1037 Do not print any progress information.
1038 </p>
1039 </dd>
1040 <dt class="hdlist1">
1041 --detect-labels
1042 </dt>
1043 <dd>
1045 Query p4 for labels associated with the depot paths, and add
1046 them as tags in Git. Limited usefulness as only imports labels
1047 associated with new changelists. Deprecated.
1048 </p>
1049 </dd>
1050 <dt class="hdlist1">
1051 --import-labels
1052 </dt>
1053 <dd>
1055 Import labels from p4 into Git.
1056 </p>
1057 </dd>
1058 <dt class="hdlist1">
1059 --import-local
1060 </dt>
1061 <dd>
1063 By default, p4 branches are stored in <em>refs/remotes/p4/</em>,
1064 where they will be treated as remote-tracking branches by
1065 <a href="git-branch.html">git-branch(1)</a> and other commands. This option instead
1066 puts p4 branches in <em>refs/heads/p4/</em>. Note that future
1067 sync operations must specify <code>--import-local</code> as well so that
1068 they can find the p4 branches in refs/heads.
1069 </p>
1070 </dd>
1071 <dt class="hdlist1">
1072 --max-changes &lt;n&gt;
1073 </dt>
1074 <dd>
1076 Import at most <em>n</em> changes, rather than the entire range of
1077 changes included in the given revision specifier. A typical
1078 usage would be use <em>@all</em> as the revision specifier, but then
1079 to use <em>--max-changes 1000</em> to import only the last 1000
1080 revisions rather than the entire revision history.
1081 </p>
1082 </dd>
1083 <dt class="hdlist1">
1084 --changes-block-size &lt;n&gt;
1085 </dt>
1086 <dd>
1088 The internal block size to use when converting a revision
1089 specifier such as <em>@all</em> into a list of specific change
1090 numbers. Instead of using a single call to <em>p4 changes</em> to
1091 find the full list of changes for the conversion, there are a
1092 sequence of calls to <em>p4 changes -m</em>, each of which requests
1093 one block of changes of the given size. The default block size
1094 is 500, which should usually be suitable.
1095 </p>
1096 </dd>
1097 <dt class="hdlist1">
1098 --keep-path
1099 </dt>
1100 <dd>
1102 The mapping of file names from the p4 depot path to Git, by
1103 default, involves removing the entire depot path. With this
1104 option, the full p4 depot path is retained in Git. For example,
1105 path <em>//depot/main/foo/bar.c</em>, when imported from
1106 <em>//depot/main/</em>, becomes <em>foo/bar.c</em>. With <code>--keep-path</code>, the
1107 Git path is instead <em>depot/main/foo/bar.c</em>.
1108 </p>
1109 </dd>
1110 <dt class="hdlist1">
1111 --use-client-spec
1112 </dt>
1113 <dd>
1115 Use a client spec to find the list of interesting files in p4.
1116 See the "CLIENT SPEC" section below.
1117 </p>
1118 </dd>
1119 <dt class="hdlist1">
1120 -/ &lt;path&gt;
1121 </dt>
1122 <dd>
1124 Exclude selected depot paths when cloning or syncing.
1125 </p>
1126 </dd>
1127 </dl></div>
1128 </div>
1129 <div class="sect2">
1130 <h3 id="_clone_options">Clone options</h3>
1131 <div class="paragraph"><p>These options can be used in an initial <em>clone</em>, along with the <em>sync</em>
1132 options described above.</p></div>
1133 <div class="dlist"><dl>
1134 <dt class="hdlist1">
1135 --destination &lt;directory&gt;
1136 </dt>
1137 <dd>
1139 Where to create the Git repository. If not provided, the last
1140 component in the p4 depot path is used to create a new
1141 directory.
1142 </p>
1143 </dd>
1144 <dt class="hdlist1">
1145 --bare
1146 </dt>
1147 <dd>
1149 Perform a bare clone. See <a href="git-clone.html">git-clone(1)</a>.
1150 </p>
1151 </dd>
1152 </dl></div>
1153 </div>
1154 <div class="sect2">
1155 <h3 id="_submit_options">Submit options</h3>
1156 <div class="paragraph"><p>These options can be used to modify <em>git p4 submit</em> behavior.</p></div>
1157 <div class="dlist"><dl>
1158 <dt class="hdlist1">
1159 --origin &lt;commit&gt;
1160 </dt>
1161 <dd>
1163 Upstream location from which commits are identified to submit to
1164 p4. By default, this is the most recent p4 commit reachable
1165 from <code>HEAD</code>.
1166 </p>
1167 </dd>
1168 <dt class="hdlist1">
1170 </dt>
1171 <dd>
1173 Detect renames. See <a href="git-diff.html">git-diff(1)</a>. Renames will be
1174 represented in p4 using explicit <em>move</em> operations. There
1175 is no corresponding option to detect copies, but there are
1176 variables for both moves and copies.
1177 </p>
1178 </dd>
1179 <dt class="hdlist1">
1180 --preserve-user
1181 </dt>
1182 <dd>
1184 Re-author p4 changes before submitting to p4. This option
1185 requires p4 admin privileges.
1186 </p>
1187 </dd>
1188 <dt class="hdlist1">
1189 --export-labels
1190 </dt>
1191 <dd>
1193 Export tags from Git as p4 labels. Tags found in Git are applied
1194 to the perforce working directory.
1195 </p>
1196 </dd>
1197 <dt class="hdlist1">
1199 </dt>
1200 <dt class="hdlist1">
1201 --dry-run
1202 </dt>
1203 <dd>
1205 Show just what commits would be submitted to p4; do not change
1206 state in Git or p4.
1207 </p>
1208 </dd>
1209 <dt class="hdlist1">
1210 --prepare-p4-only
1211 </dt>
1212 <dd>
1214 Apply a commit to the p4 workspace, opening, adding and deleting
1215 files in p4 as for a normal submit operation. Do not issue the
1216 final "p4 submit", but instead print a message about how to
1217 submit manually or revert. This option always stops after the
1218 first (oldest) commit. Git tags are not exported to p4.
1219 </p>
1220 </dd>
1221 <dt class="hdlist1">
1222 --shelve
1223 </dt>
1224 <dd>
1226 Instead of submitting create a series of shelved changelists.
1227 After creating each shelve, the relevant files are reverted/deleted.
1228 If you have multiple commits pending multiple shelves will be created.
1229 </p>
1230 </dd>
1231 <dt class="hdlist1">
1232 --update-shelve CHANGELIST
1233 </dt>
1234 <dd>
1236 Update an existing shelved changelist with this commit. Implies
1237 --shelve. Repeat for multiple shelved changelists.
1238 </p>
1239 </dd>
1240 <dt class="hdlist1">
1241 --conflict=(ask|skip|quit)
1242 </dt>
1243 <dd>
1245 Conflicts can occur when applying a commit to p4. When this
1246 happens, the default behavior ("ask") is to prompt whether to
1247 skip this commit and continue, or quit. This option can be used
1248 to bypass the prompt, causing conflicting commits to be automatically
1249 skipped, or to quit trying to apply commits, without prompting.
1250 </p>
1251 </dd>
1252 <dt class="hdlist1">
1253 --branch &lt;branch&gt;
1254 </dt>
1255 <dd>
1257 After submitting, sync this named branch instead of the default
1258 p4/master. See the "Sync options" section above for more
1259 information.
1260 </p>
1261 </dd>
1262 <dt class="hdlist1">
1263 --commit (&lt;sha1&gt;|&lt;sha1&gt;..&lt;sha1&gt;)
1264 </dt>
1265 <dd>
1267 Submit only the specified commit or range of commits, instead of the full
1268 list of changes that are in the current Git branch.
1269 </p>
1270 </dd>
1271 <dt class="hdlist1">
1272 --disable-rebase
1273 </dt>
1274 <dd>
1276 Disable the automatic rebase after all commits have been successfully
1277 submitted. Can also be set with git-p4.disableRebase.
1278 </p>
1279 </dd>
1280 <dt class="hdlist1">
1281 --disable-p4sync
1282 </dt>
1283 <dd>
1285 Disable the automatic sync of p4/master from Perforce after commits have
1286 been submitted. Implies --disable-rebase. Can also be set with
1287 git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.
1288 </p>
1289 </dd>
1290 </dl></div>
1291 </div>
1292 </div>
1293 </div>
1294 <div class="sect1">
1295 <h2 id="_hooks_for_submit">Hooks for submit</h2>
1296 <div class="sectionbody">
1297 <div class="sect2">
1298 <h3 id="_p4_pre_submit">p4-pre-submit</h3>
1299 <div class="paragraph"><p>The <code>p4-pre-submit</code> hook is executed if it exists and is executable.
1300 The hook takes no parameters and nothing from standard input. Exiting with
1301 non-zero status from this script prevents <code>git-p4 submit</code> from launching.
1302 It can be bypassed with the <code>--no-verify</code> command line option.</p></div>
1303 <div class="paragraph"><p>One usage scenario is to run unit tests in the hook.</p></div>
1304 </div>
1305 <div class="sect2">
1306 <h3 id="_p4_prepare_changelist">p4-prepare-changelist</h3>
1307 <div class="paragraph"><p>The <code>p4-prepare-changelist</code> hook is executed right after preparing
1308 the default changelist message and before the editor is started.
1309 It takes one parameter, the name of the file that contains the
1310 changelist text. Exiting with a non-zero status from the script
1311 will abort the process.</p></div>
1312 <div class="paragraph"><p>The purpose of the hook is to edit the message file in place,
1313 and it is not suppressed by the <code>--no-verify</code> option. This hook
1314 is called even if <code>--prepare-p4-only</code> is set.</p></div>
1315 </div>
1316 <div class="sect2">
1317 <h3 id="_p4_changelist">p4-changelist</h3>
1318 <div class="paragraph"><p>The <code>p4-changelist</code> hook is executed after the changelist
1319 message has been edited by the user. It can be bypassed with the
1320 <code>--no-verify</code> option. It takes a single parameter, the name
1321 of the file that holds the proposed changelist text. Exiting
1322 with a non-zero status causes the command to abort.</p></div>
1323 <div class="paragraph"><p>The hook is allowed to edit the changelist file and can be used
1324 to normalize the text into some project standard format. It can
1325 also be used to refuse the Submit after inspect the message file.</p></div>
1326 </div>
1327 <div class="sect2">
1328 <h3 id="_p4_post_changelist">p4-post-changelist</h3>
1329 <div class="paragraph"><p>The <code>p4-post-changelist</code> hook is invoked after the submit has
1330 successfully occurred in P4. It takes no parameters and is meant
1331 primarily for notification and cannot affect the outcome of the
1332 git p4 submit action.</p></div>
1333 </div>
1334 <div class="sect2">
1335 <h3 id="_rebase_options">Rebase options</h3>
1336 <div class="paragraph"><p>These options can be used to modify <em>git p4 rebase</em> behavior.</p></div>
1337 <div class="dlist"><dl>
1338 <dt class="hdlist1">
1339 --import-labels
1340 </dt>
1341 <dd>
1343 Import p4 labels.
1344 </p>
1345 </dd>
1346 </dl></div>
1347 </div>
1348 <div class="sect2">
1349 <h3 id="_unshelve_options">Unshelve options</h3>
1350 <div class="dlist"><dl>
1351 <dt class="hdlist1">
1352 --origin
1353 </dt>
1354 <dd>
1356 Sets the git refspec against which the shelved P4 changelist is compared.
1357 Defaults to p4/master.
1358 </p>
1359 </dd>
1360 </dl></div>
1361 </div>
1362 </div>
1363 </div>
1364 <div class="sect1">
1365 <h2 id="_depot_path_syntax">DEPOT PATH SYNTAX</h2>
1366 <div class="sectionbody">
1367 <div class="paragraph"><p>The p4 depot path argument to <em>git p4 sync</em> and <em>git p4 clone</em> can
1368 be one or more space-separated p4 depot paths, with an optional
1369 p4 revision specifier on the end:</p></div>
1370 <div class="dlist"><dl>
1371 <dt class="hdlist1">
1372 "//depot/my/project"
1373 </dt>
1374 <dd>
1376 Import one commit with all files in the <em>#head</em> change under that tree.
1377 </p>
1378 </dd>
1379 <dt class="hdlist1">
1380 "//depot/my/project@all"
1381 </dt>
1382 <dd>
1384 Import one commit for each change in the history of that depot path.
1385 </p>
1386 </dd>
1387 <dt class="hdlist1">
1388 "//depot/my/project@1,6"
1389 </dt>
1390 <dd>
1392 Import only changes 1 through 6.
1393 </p>
1394 </dd>
1395 <dt class="hdlist1">
1396 "//depot/proj1@all //depot/proj2@all"
1397 </dt>
1398 <dd>
1400 Import all changes from both named depot paths into a single
1401 repository. Only files below these directories are included.
1402 There is not a subdirectory in Git for each "proj1" and "proj2".
1403 You must use the <code>--destination</code> option when specifying more
1404 than one depot path. The revision specifier must be specified
1405 identically on each depot path. If there are files in the
1406 depot paths with the same name, the path with the most recently
1407 updated version of the file is the one that appears in Git.
1408 </p>
1409 </dd>
1410 </dl></div>
1411 <div class="paragraph"><p>See <em>p4 help revisions</em> for the full syntax of p4 revision specifiers.</p></div>
1412 </div>
1413 </div>
1414 <div class="sect1">
1415 <h2 id="_client_spec">CLIENT SPEC</h2>
1416 <div class="sectionbody">
1417 <div class="paragraph"><p>The p4 client specification is maintained with the <em>p4 client</em> command
1418 and contains among other fields, a View that specifies how the depot
1419 is mapped into the client repository. The <em>clone</em> and <em>sync</em> commands
1420 can consult the client spec when given the <code>--use-client-spec</code> option or
1421 when the useClientSpec variable is true. After <em>git p4 clone</em>, the
1422 useClientSpec variable is automatically set in the repository
1423 configuration file. This allows future <em>git p4 submit</em> commands to
1424 work properly; the submit command looks only at the variable and does
1425 not have a command-line option.</p></div>
1426 <div class="paragraph"><p>The full syntax for a p4 view is documented in <em>p4 help views</em>. <em>git p4</em>
1427 knows only a subset of the view syntax. It understands multi-line
1428 mappings, overlays with <em>+</em>, exclusions with <em>-</em> and double-quotes
1429 around whitespace. Of the possible wildcards, <em>git p4</em> only handles
1430 <em>&#8230;</em>, and only when it is at the end of the path. <em>git p4</em> will complain
1431 if it encounters an unhandled wildcard.</p></div>
1432 <div class="paragraph"><p>Bugs in the implementation of overlap mappings exist. If multiple depot
1433 paths map through overlays to the same location in the repository,
1434 <em>git p4</em> can choose the wrong one. This is hard to solve without
1435 dedicating a client spec just for <em>git p4</em>.</p></div>
1436 <div class="paragraph"><p>The name of the client can be given to <em>git p4</em> in multiple ways. The
1437 variable <em>git-p4.client</em> takes precedence if it exists. Otherwise,
1438 normal p4 mechanisms of determining the client are used: environment
1439 variable <code>P4CLIENT</code>, a file referenced by <code>P4CONFIG</code>, or the local host name.</p></div>
1440 </div>
1441 </div>
1442 <div class="sect1">
1443 <h2 id="_branch_detection">BRANCH DETECTION</h2>
1444 <div class="sectionbody">
1445 <div class="paragraph"><p>P4 does not have the same concept of a branch as Git. Instead,
1446 p4 organizes its content as a directory tree, where by convention
1447 different logical branches are in different locations in the tree.
1448 The <em>p4 branch</em> command is used to maintain mappings between
1449 different areas in the tree, and indicate related content. <em>git p4</em>
1450 can use these mappings to determine branch relationships.</p></div>
1451 <div class="paragraph"><p>If you have a repository where all the branches of interest exist as
1452 subdirectories of a single depot path, you can use <code>--detect-branches</code>
1453 when cloning or syncing to have <em>git p4</em> automatically find
1454 subdirectories in p4, and to generate these as branches in Git.</p></div>
1455 <div class="paragraph"><p>For example, if the P4 repository structure is:</p></div>
1456 <div class="listingblock">
1457 <div class="content">
1458 <pre><code>//depot/main/...
1459 //depot/branch1/...</code></pre>
1460 </div></div>
1461 <div class="paragraph"><p>And "p4 branch -o branch1" shows a View line that looks like:</p></div>
1462 <div class="listingblock">
1463 <div class="content">
1464 <pre><code>//depot/main/... //depot/branch1/...</code></pre>
1465 </div></div>
1466 <div class="paragraph"><p>Then this <em>git p4 clone</em> command:</p></div>
1467 <div class="listingblock">
1468 <div class="content">
1469 <pre><code>git p4 clone --detect-branches //depot@all</code></pre>
1470 </div></div>
1471 <div class="paragraph"><p>produces a separate branch in <em>refs/remotes/p4/</em> for //depot/main,
1472 called <em>master</em>, and one for //depot/branch1 called <em>depot/branch1</em>.</p></div>
1473 <div class="paragraph"><p>However, it is not necessary to create branches in p4 to be able to use
1474 them like branches. Because it is difficult to infer branch
1475 relationships automatically, a Git configuration setting
1476 <em>git-p4.branchList</em> can be used to explicitly identify branch
1477 relationships. It is a list of "source:destination" pairs, like a
1478 simple p4 branch specification, where the "source" and "destination" are
1479 the path elements in the p4 repository. The example above relied on the
1480 presence of the p4 branch. Without p4 branches, the same result will
1481 occur with:</p></div>
1482 <div class="listingblock">
1483 <div class="content">
1484 <pre><code>git init depot
1485 cd depot
1486 git config git-p4.branchList main:branch1
1487 git p4 clone --detect-branches //depot@all .</code></pre>
1488 </div></div>
1489 </div>
1490 </div>
1491 <div class="sect1">
1492 <h2 id="_performance">PERFORMANCE</h2>
1493 <div class="sectionbody">
1494 <div class="paragraph"><p>The fast-import mechanism used by <em>git p4</em> creates one pack file for
1495 each invocation of <em>git p4 sync</em>. Normally, Git garbage compression
1496 (<a href="git-gc.html">git-gc(1)</a>) automatically compresses these to fewer pack files,
1497 but explicit invocation of <em>git repack -adf</em> may improve performance.</p></div>
1498 </div>
1499 </div>
1500 <div class="sect1">
1501 <h2 id="_configuration_variables">CONFIGURATION VARIABLES</h2>
1502 <div class="sectionbody">
1503 <div class="paragraph"><p>The following config settings can be used to modify <em>git p4</em> behavior.
1504 They all are in the <em>git-p4</em> section.</p></div>
1505 <div class="sect2">
1506 <h3 id="_general_variables">General variables</h3>
1507 <div class="dlist"><dl>
1508 <dt class="hdlist1">
1509 git-p4.user
1510 </dt>
1511 <dd>
1513 User specified as an option to all p4 commands, with <em>-u &lt;user&gt;</em>.
1514 The environment variable <code>P4USER</code> can be used instead.
1515 </p>
1516 </dd>
1517 <dt class="hdlist1">
1518 git-p4.password
1519 </dt>
1520 <dd>
1522 Password specified as an option to all p4 commands, with
1523 <em>-P &lt;password&gt;</em>.
1524 The environment variable <code>P4PASS</code> can be used instead.
1525 </p>
1526 </dd>
1527 <dt class="hdlist1">
1528 git-p4.port
1529 </dt>
1530 <dd>
1532 Port specified as an option to all p4 commands, with
1533 <em>-p &lt;port&gt;</em>.
1534 The environment variable <code>P4PORT</code> can be used instead.
1535 </p>
1536 </dd>
1537 <dt class="hdlist1">
1538 git-p4.host
1539 </dt>
1540 <dd>
1542 Host specified as an option to all p4 commands, with
1543 <em>-h &lt;host&gt;</em>.
1544 The environment variable <code>P4HOST</code> can be used instead.
1545 </p>
1546 </dd>
1547 <dt class="hdlist1">
1548 git-p4.client
1549 </dt>
1550 <dd>
1552 Client specified as an option to all p4 commands, with
1553 <em>-c &lt;client&gt;</em>, including the client spec.
1554 </p>
1555 </dd>
1556 <dt class="hdlist1">
1557 git-p4.retries
1558 </dt>
1559 <dd>
1561 Specifies the number of times to retry a p4 command (notably,
1562 <em>p4 sync</em>) if the network times out. The default value is 3.
1563 Set the value to 0 to disable retries or if your p4 version
1564 does not support retries (pre 2012.2).
1565 </p>
1566 </dd>
1567 </dl></div>
1568 </div>
1569 <div class="sect2">
1570 <h3 id="_clone_and_sync_variables">Clone and sync variables</h3>
1571 <div class="dlist"><dl>
1572 <dt class="hdlist1">
1573 git-p4.syncFromOrigin
1574 </dt>
1575 <dd>
1577 Because importing commits from other Git repositories is much faster
1578 than importing them from p4, a mechanism exists to find p4 changes
1579 first in Git remotes. If branches exist under <em>refs/remote/origin/p4</em>,
1580 those will be fetched and used when syncing from p4. This
1581 variable can be set to <em>false</em> to disable this behavior.
1582 </p>
1583 </dd>
1584 <dt class="hdlist1">
1585 git-p4.branchUser
1586 </dt>
1587 <dd>
1589 One phase in branch detection involves looking at p4 branches
1590 to find new ones to import. By default, all branches are
1591 inspected. This option limits the search to just those owned
1592 by the single user named in the variable.
1593 </p>
1594 </dd>
1595 <dt class="hdlist1">
1596 git-p4.branchList
1597 </dt>
1598 <dd>
1600 List of branches to be imported when branch detection is
1601 enabled. Each entry should be a pair of branch names separated
1602 by a colon (:). This example declares that both branchA and
1603 branchB were created from main:
1604 </p>
1605 <div class="listingblock">
1606 <div class="content">
1607 <pre><code>git config git-p4.branchList main:branchA
1608 git config --add git-p4.branchList main:branchB</code></pre>
1609 </div></div>
1610 </dd>
1611 <dt class="hdlist1">
1612 git-p4.ignoredP4Labels
1613 </dt>
1614 <dd>
1616 List of p4 labels to ignore. This is built automatically as
1617 unimportable labels are discovered.
1618 </p>
1619 </dd>
1620 <dt class="hdlist1">
1621 git-p4.importLabels
1622 </dt>
1623 <dd>
1625 Import p4 labels into git, as per --import-labels.
1626 </p>
1627 </dd>
1628 <dt class="hdlist1">
1629 git-p4.labelImportRegexp
1630 </dt>
1631 <dd>
1633 Only p4 labels matching this regular expression will be imported. The
1634 default value is <em>[a-zA-Z0-9_\-.]+$</em>.
1635 </p>
1636 </dd>
1637 <dt class="hdlist1">
1638 git-p4.useClientSpec
1639 </dt>
1640 <dd>
1642 Specify that the p4 client spec should be used to identify p4
1643 depot paths of interest. This is equivalent to specifying the
1644 option <code>--use-client-spec</code>. See the "CLIENT SPEC" section above.
1645 This variable is a boolean, not the name of a p4 client.
1646 </p>
1647 </dd>
1648 <dt class="hdlist1">
1649 git-p4.pathEncoding
1650 </dt>
1651 <dd>
1653 Perforce keeps the encoding of a path as given by the originating OS.
1654 Git expects paths encoded as UTF-8. Use this config to tell git-p4
1655 what encoding Perforce had used for the paths. This encoding is used
1656 to transcode the paths to UTF-8. As an example, Perforce on Windows
1657 often uses "cp1252" to encode path names. If this option is passed
1658 into a p4 clone request, it is persisted in the resulting new git
1659 repo.
1660 </p>
1661 </dd>
1662 <dt class="hdlist1">
1663 git-p4.metadataDecodingStrategy
1664 </dt>
1665 <dd>
1667 Perforce keeps the encoding of a changelist descriptions and user
1668 full names as stored by the client on a given OS. The p4v client
1669 uses the OS-local encoding, and so different users can end up storing
1670 different changelist descriptions or user full names in different
1671 encodings, in the same depot.
1672 Git tolerates inconsistent/incorrect encodings in commit messages
1673 and author names, but expects them to be specified in utf-8.
1674 git-p4 can use three different decoding strategies in handling the
1675 encoding uncertainty in Perforce: <em>passthrough</em> simply passes the
1676 original bytes through from Perforce to git, creating usable but
1677 incorrectly-encoded data when the Perforce data is encoded as
1678 anything other than utf-8. <em>strict</em> expects the Perforce data to be
1679 encoded as utf-8, and fails to import when this is not true.
1680 <em>fallback</em> attempts to interpret the data as utf-8, and otherwise
1681 falls back to using a secondary encoding - by default the common
1682 windows encoding <em>cp-1252</em> - with upper-range bytes escaped if
1683 decoding with the fallback encoding also fails.
1684 Under python2 the default strategy is <em>passthrough</em> for historical
1685 reasons, and under python3 the default is <em>fallback</em>.
1686 When <em>strict</em> is selected and decoding fails, the error message will
1687 propose changing this config parameter as a workaround. If this
1688 option is passed into a p4 clone request, it is persisted into the
1689 resulting new git repo.
1690 </p>
1691 </dd>
1692 <dt class="hdlist1">
1693 git-p4.metadataFallbackEncoding
1694 </dt>
1695 <dd>
1697 Specify the fallback encoding to use when decoding Perforce author
1698 names and changelists descriptions using the <em>fallback</em> strategy
1699 (see git-p4.metadataDecodingStrategy). The fallback encoding will
1700 only be used when decoding as utf-8 fails. This option defaults to
1701 cp1252, a common windows encoding. If this option is passed into a
1702 p4 clone request, it is persisted into the resulting new git repo.
1703 </p>
1704 </dd>
1705 <dt class="hdlist1">
1706 git-p4.largeFileSystem
1707 </dt>
1708 <dd>
1710 Specify the system that is used for large (binary) files. Please note
1711 that large file systems do not support the <em>git p4 submit</em> command.
1712 Only Git LFS is implemented right now (see <a href="https://git-lfs.github.com/">https://git-lfs.github.com/</a>
1713 for more information). Download and install the Git LFS command line
1714 extension to use this option and configure it like this:
1715 </p>
1716 <div class="listingblock">
1717 <div class="content">
1718 <pre><code>git config git-p4.largeFileSystem GitLFS</code></pre>
1719 </div></div>
1720 </dd>
1721 <dt class="hdlist1">
1722 git-p4.largeFileExtensions
1723 </dt>
1724 <dd>
1726 All files matching a file extension in the list will be processed
1727 by the large file system. Do not prefix the extensions with <em>.</em>.
1728 </p>
1729 </dd>
1730 <dt class="hdlist1">
1731 git-p4.largeFileThreshold
1732 </dt>
1733 <dd>
1735 All files with an uncompressed size exceeding the threshold will be
1736 processed by the large file system. By default the threshold is
1737 defined in bytes. Add the suffix k, m, or g to change the unit.
1738 </p>
1739 </dd>
1740 <dt class="hdlist1">
1741 git-p4.largeFileCompressedThreshold
1742 </dt>
1743 <dd>
1745 All files with a compressed size exceeding the threshold will be
1746 processed by the large file system. This option might slow down
1747 your clone/sync process. By default the threshold is defined in
1748 bytes. Add the suffix k, m, or g to change the unit.
1749 </p>
1750 </dd>
1751 <dt class="hdlist1">
1752 git-p4.largeFilePush
1753 </dt>
1754 <dd>
1756 Boolean variable which defines if large files are automatically
1757 pushed to a server.
1758 </p>
1759 </dd>
1760 <dt class="hdlist1">
1761 git-p4.keepEmptyCommits
1762 </dt>
1763 <dd>
1765 A changelist that contains only excluded files will be imported
1766 as an empty commit if this boolean option is set to true.
1767 </p>
1768 </dd>
1769 <dt class="hdlist1">
1770 git-p4.mapUser
1771 </dt>
1772 <dd>
1774 Map a P4 user to a name and email address in Git. Use a string
1775 with the following format to create a mapping:
1776 </p>
1777 <div class="listingblock">
1778 <div class="content">
1779 <pre><code>git config --add git-p4.mapUser "p4user = First Last &lt;mail@address.com&gt;"</code></pre>
1780 </div></div>
1781 <div class="paragraph"><p>A mapping will override any user information from P4. Mappings for
1782 multiple P4 user can be defined.</p></div>
1783 </dd>
1784 </dl></div>
1785 </div>
1786 <div class="sect2">
1787 <h3 id="_submit_variables">Submit variables</h3>
1788 <div class="dlist"><dl>
1789 <dt class="hdlist1">
1790 git-p4.detectRenames
1791 </dt>
1792 <dd>
1794 Detect renames. See <a href="git-diff.html">git-diff(1)</a>. This can be true,
1795 false, or a score as expected by <em>git diff -M</em>.
1796 </p>
1797 </dd>
1798 <dt class="hdlist1">
1799 git-p4.detectCopies
1800 </dt>
1801 <dd>
1803 Detect copies. See <a href="git-diff.html">git-diff(1)</a>. This can be true,
1804 false, or a score as expected by <em>git diff -C</em>.
1805 </p>
1806 </dd>
1807 <dt class="hdlist1">
1808 git-p4.detectCopiesHarder
1809 </dt>
1810 <dd>
1812 Detect copies harder. See <a href="git-diff.html">git-diff(1)</a>. A boolean.
1813 </p>
1814 </dd>
1815 <dt class="hdlist1">
1816 git-p4.preserveUser
1817 </dt>
1818 <dd>
1820 On submit, re-author changes to reflect the Git author,
1821 regardless of who invokes <em>git p4 submit</em>.
1822 </p>
1823 </dd>
1824 <dt class="hdlist1">
1825 git-p4.allowMissingP4Users
1826 </dt>
1827 <dd>
1829 When <em>preserveUser</em> is true, <em>git p4</em> normally dies if it
1830 cannot find an author in the p4 user map. This setting
1831 submits the change regardless.
1832 </p>
1833 </dd>
1834 <dt class="hdlist1">
1835 git-p4.skipSubmitEdit
1836 </dt>
1837 <dd>
1839 The submit process invokes the editor before each p4 change
1840 is submitted. If this setting is true, though, the editing
1841 step is skipped.
1842 </p>
1843 </dd>
1844 <dt class="hdlist1">
1845 git-p4.skipSubmitEditCheck
1846 </dt>
1847 <dd>
1849 After editing the p4 change message, <em>git p4</em> makes sure that
1850 the description really was changed by looking at the file
1851 modification time. This option disables that test.
1852 </p>
1853 </dd>
1854 <dt class="hdlist1">
1855 git-p4.allowSubmit
1856 </dt>
1857 <dd>
1859 By default, any branch can be used as the source for a <em>git p4
1860 submit</em> operation. This configuration variable, if set, permits only
1861 the named branches to be used as submit sources. Branch names
1862 must be the short names (no "refs/heads/"), and should be
1863 separated by commas (","), with no spaces.
1864 </p>
1865 </dd>
1866 <dt class="hdlist1">
1867 git-p4.skipUserNameCheck
1868 </dt>
1869 <dd>
1871 If the user running <em>git p4 submit</em> does not exist in the p4
1872 user map, <em>git p4</em> exits. This option can be used to force
1873 submission regardless.
1874 </p>
1875 </dd>
1876 <dt class="hdlist1">
1877 git-p4.attemptRCSCleanup
1878 </dt>
1879 <dd>
1881 If enabled, <em>git p4 submit</em> will attempt to cleanup RCS keywords
1882 ($Header$, etc). These would otherwise cause merge conflicts and prevent
1883 the submit going ahead. This option should be considered experimental at
1884 present.
1885 </p>
1886 </dd>
1887 <dt class="hdlist1">
1888 git-p4.exportLabels
1889 </dt>
1890 <dd>
1892 Export Git tags to p4 labels, as per --export-labels.
1893 </p>
1894 </dd>
1895 <dt class="hdlist1">
1896 git-p4.labelExportRegexp
1897 </dt>
1898 <dd>
1900 Only p4 labels matching this regular expression will be exported. The
1901 default value is <em>[a-zA-Z0-9_\-.]+$</em>.
1902 </p>
1903 </dd>
1904 <dt class="hdlist1">
1905 git-p4.conflict
1906 </dt>
1907 <dd>
1909 Specify submit behavior when a conflict with p4 is found, as per
1910 --conflict. The default behavior is <em>ask</em>.
1911 </p>
1912 </dd>
1913 <dt class="hdlist1">
1914 git-p4.disableRebase
1915 </dt>
1916 <dd>
1918 Do not rebase the tree against p4/master following a submit.
1919 </p>
1920 </dd>
1921 <dt class="hdlist1">
1922 git-p4.disableP4Sync
1923 </dt>
1924 <dd>
1926 Do not sync p4/master with Perforce following a submit. Implies git-p4.disableRebase.
1927 </p>
1928 </dd>
1929 </dl></div>
1930 </div>
1931 </div>
1932 </div>
1933 <div class="sect1">
1934 <h2 id="_implementation_details">IMPLEMENTATION DETAILS</h2>
1935 <div class="sectionbody">
1936 <div class="ulist"><ul>
1937 <li>
1939 Changesets from p4 are imported using Git fast-import.
1940 </p>
1941 </li>
1942 <li>
1944 Cloning or syncing does not require a p4 client; file contents are
1945 collected using <em>p4 print</em>.
1946 </p>
1947 </li>
1948 <li>
1950 Submitting requires a p4 client, which is not in the same location
1951 as the Git repository. Patches are applied, one at a time, to
1952 this p4 client and submitted from there.
1953 </p>
1954 </li>
1955 <li>
1957 Each commit imported by <em>git p4</em> has a line at the end of the log
1958 message indicating the p4 depot location and change number. This
1959 line is used by later <em>git p4 sync</em> operations to know which p4
1960 changes are new.
1961 </p>
1962 </li>
1963 </ul></div>
1964 </div>
1965 </div>
1966 <div class="sect1">
1967 <h2 id="_git">GIT</h2>
1968 <div class="sectionbody">
1969 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1970 </div>
1971 </div>
1972 </div>
1973 <div id="footnotes"><hr /></div>
1974 <div id="footer">
1975 <div id="footer-text">
1976 Last updated
1977 2022-05-20 17:49:41 PDT
1978 </div>
1979 </div>
1980 </body>
1981 </html>