Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: docs/html/depot_tools_tutorial.html

Issue 238203002: Move walkthrough to end of tutorial, add real TL;DR section. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | docs/man7/depot_tools_tutorial.7 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head> 4 <head>
5 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" / > 5 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" / >
6 <meta name="generator" content="AsciiDoc 8.6.9" /> 6 <meta name="generator" content="AsciiDoc 8.6.9" />
7 <title>depot_tools_tutorial(7)</title> 7 <title>depot_tools_tutorial(7)</title>
8 <style type="text/css"> 8 <style type="text/css">
9 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ 9 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10 10
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 <a href="#_setting_up">Setting up</a> 764 <a href="#_setting_up">Setting up</a>
765 </p> 765 </p>
766 </li> 766 </li>
767 <li> 767 <li>
768 <p> 768 <p>
769 <a href="#_getting_the_code">Getting the code</a> 769 <a href="#_getting_the_code">Getting the code</a>
770 </p> 770 </p>
771 </li> 771 </li>
772 <li> 772 <li>
773 <p> 773 <p>
774 <a href="#_tl_dr_walkthrough">TL;DR Walkthrough</a> 774 <a href="#_tl_dr">TL;DR</a>
775 </p> 775 </p>
776 </li> 776 </li>
777 <li> 777 <li>
778 <p> 778 <p>
779 <a href="#_creating_uploading_a_cl">Creating / Uploading a CL</a> 779 <a href="#_creating_uploading_a_cl">Creating / Uploading a CL</a>
780 </p> 780 </p>
781 </li> 781 </li>
782 <li> 782 <li>
783 <p> 783 <p>
784 <a href="#_updating_the_code">Updating the code</a> 784 <a href="#_updating_the_code">Updating the code</a>
785 </p> 785 </p>
786 </li> 786 </li>
787 <li> 787 <li>
788 <p> 788 <p>
789 <a href="#_managing_multiple_cls">Managing multiple CLs</a> 789 <a href="#_managing_multiple_cls">Managing multiple CLs</a>
790 </p> 790 </p>
791 </li> 791 </li>
792 <li> 792 <li>
793 <p> 793 <p>
794 <a href="#_managing_dependent_cls">Managing dependent CLs</a> 794 <a href="#_managing_dependent_cls">Managing dependent CLs</a>
795 </p> 795 </p>
796 </li> 796 </li>
797 <li>
798 <p>
799 <a href="#_example_walkthrough">Example Walkthrough</a>
800 </p>
801 </li>
797 </ul></div> 802 </ul></div>
798 <div class="paragraph"><p>Please refer to the manpages (or <code>--help</code> o utput) for details about any of the 803 <div class="paragraph"><p>Please refer to the manpages (or <code>--help</code> o utput) for details about any of the
799 commands mentioned in this tutorial.</p></div> 804 commands mentioned in this tutorial.</p></div>
800 <div class="admonitionblock"> 805 <div class="admonitionblock">
801 <table><tr> 806 <table><tr>
802 <td class="icon"> 807 <td class="icon">
803 <div class="title">Note</div> 808 <div class="title">Note</div>
804 </td> 809 </td>
805 <td class="content">If your platform does not support manpages (or you prefer so mething a bit more 810 <td class="content">If your platform does not support manpages (or you prefer so mething a bit more
806 expressive than plain text) you can find all documentation in <em>html</em> form in the 811 expressive than plain text) you can find all documentation in <em>html</em> form in the
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 <strong><span class="white">$ git config --global user.email &#8220;jdoe@email.c om&#8221;</span></strong> 977 <strong><span class="white">$ git config --global user.email &#8220;jdoe@email.c om&#8221;</span></strong>
973 <strong><span class="white">$ git config --global core.autocrlf false</span></st rong> 978 <strong><span class="white">$ git config --global core.autocrlf false</span></st rong>
974 <strong><span class="white">$ git config --global core.filemode false</span></st rong> 979 <strong><span class="white">$ git config --global core.filemode false</span></st rong>
975 <strong><span class="white">$</span></strong> # and for fun! 980 <strong><span class="white">$</span></strong> # and for fun!
976 <strong><span class="white">$ git config --global color.ui true</span></strong>< /code></pre> 981 <strong><span class="white">$ git config --global color.ui true</span></strong>< /code></pre>
977 </div></div> 982 </div></div>
978 </div> 983 </div>
979 </div> 984 </div>
980 </div> 985 </div>
981 <div class="sect1"> 986 <div class="sect1">
987 <h2 id="_tl_dr">TL;DR</h2>
988 <div class="sectionbody">
989 <div class="listingblock">
990 <div class="content">
991 <pre><code><strong><span class="white">$</span></strong> # get the code
992 <strong><span class="white">$</span></strong> # In an empty directory:
993 <strong><span class="white">$ fetch {chromium,blink,...}</span></strong>
994
995 <strong><span class="white">$</span></strong> # Update third_party repos and run pre-compile hooks
996 <strong><span class="white">$ gclient sync</span></strong>
997
998 <strong><span class="white">$</span></strong> # Make a new change and upload it for review
999 <strong><span class="white">$ git new-branch branchname</span></strong>
1000 <strong><span class="white">$</span></strong> # repeat: [edit, git add, git comm it]
1001 <strong><span class="white">$ git cl upload</span></strong>
1002
1003 <strong><span class="white">$</span></strong> # After change is reviewed, commit with the CQ
1004 <strong><span class="white">$ git cl set_commit</span></strong>
1005 <strong><span class="white">$</span></strong> # Note that the committed hash whi ch lands will /not/ match the
1006 <strong><span class="white">$</span></strong> # commit hashes of your local bran ch.</code></pre>
1007 </div></div>
1008 </div>
1009 </div>
1010 <div class="sect1">
982 <h2 id="_getting_the_code">GETTING THE CODE</h2> 1011 <h2 id="_getting_the_code">GETTING THE CODE</h2>
983 <div class="sectionbody"> 1012 <div class="sectionbody">
984 <div class="paragraph"><p>Pick an empty directory and run one of the following:< /p></div> 1013 <div class="paragraph"><p>Pick an empty directory and run one of the following:< /p></div>
985 <div class="listingblock"> 1014 <div class="listingblock">
986 <div class="content"> 1015 <div class="content">
987 <pre><code><strong><span class="white">$ fetch chromium</span></strong> # Basic checkout for desktop Chromium 1016 <pre><code><strong><span class="white">$ fetch chromium</span></strong> # Basic checkout for desktop Chromium
988 <strong><span class="white">$ fetch blink</span></strong> # Chromium code wi th Blink checked out to tip-of-tree 1017 <strong><span class="white">$ fetch blink</span></strong> # Chromium code wi th Blink checked out to tip-of-tree
989 <strong><span class="white">$ fetch android</span></strong> # Chromium checkou t for Android platform 1018 <strong><span class="white">$ fetch android</span></strong> # Chromium checkou t for Android platform
990 <strong><span class="white">$ fetch ios</span></strong> # Chromium checkou t for iOS platform</code></pre> 1019 <strong><span class="white">$ fetch ios</span></strong> # Chromium checkou t for iOS platform</code></pre>
991 </div></div> 1020 </div></div>
992 <div class="paragraph"><p>When the <code>fetch</code> tool completes you should have the following in your working 1021 <div class="paragraph"><p>When the <code>fetch</code> tool completes you should have the following in your working
993 directory:</p></div> 1022 directory:</p></div>
994 <div class="listingblock"> 1023 <div class="listingblock">
995 <div class="content"> 1024 <div class="content">
996 <pre><code><strong><span class="white">.gclient</span></strong> # A configurat ion file for you source checkout 1025 <pre><code><strong><span class="white">.gclient</span></strong> # A configurat ion file for you source checkout
997 <strong><span class="white">src/</span></strong> # Top-level Chromium sour ce checkout.</code></pre> 1026 <strong><span class="white">src/</span></strong> # Top-level Chromium sour ce checkout.</code></pre>
998 </div></div> 1027 </div></div>
999 <div class="paragraph"><p>If you are on linux, then you&#8217;ll need to run:</p ></div> 1028 <div class="paragraph"><p>If you are on linux, then you&#8217;ll need to run:</p ></div>
1000 <div class="listingblock"> 1029 <div class="listingblock">
1001 <div class="content"> 1030 <div class="content">
1002 <pre><code><strong><span class="white">$ cd src &amp;&amp; ./build/install-build -deps.sh</span></strong></code></pre> 1031 <pre><code><strong><span class="white">$ cd src &amp;&amp; ./build/install-build -deps.sh</span></strong></code></pre>
1003 </div></div> 1032 </div></div>
1004 <div class="paragraph"><p>And finally:</p></div> 1033 <div class="paragraph"><p>And finally:</p></div>
1005 <div class="listingblock"> 1034 <div class="listingblock">
1006 <div class="content"> 1035 <div class="content">
1007 <pre><code><strong><span class="white">$ gclient sync</span></strong> <b>&lt;1&g t;</b></code></pre> 1036 <pre><code><strong><span class="white">$ gclient sync</span></strong></code></pr e>
1008 </div></div> 1037 </div></div>
1009 <div class="colist arabic"><ol> 1038 <div class="paragraph"><p>This will pull all dependencies of the Chromium src ch eckout. You will need
1010 <li> 1039 to run this any time you update the main src checkout.</p></div>
1040 </div>
1041 </div>
1042 <div class="sect1">
1043 <h2 id="_creating_uploading_a_cl">CREATING / UPLOADING A CL</h2>
1044 <div class="sectionbody">
1045 <div class="admonitionblock">
1046 <table><tr>
1047 <td class="icon">
1048 <div class="title">Note</div>
1049 </td>
1050 <td class="content">The remainder of the tutorial assumes that your current work ing directory
1051 is the <code>src/</code> folder mentioned in <a href="#_getting_the_code">Gettin g the code</a>.</td>
1052 </tr></table>
1053 </div>
1054 <div class="paragraph"><p>Each CL corresponds exactly with a single branch in gi t. Any time you want to
1055 begin a new CL, just:</p></div>
1056 <div class="listingblock">
1057 <div class="content">
1058 <pre><code><strong><span class="white">$ git new-branch &lt;branch_name&gt;</spa n></strong></code></pre>
1059 </div></div>
1060 <div class="paragraph"><p>This will create and checkout a new branch named <code >branch_name</code> which will track
1061 the default upstream (which is <code>origin/master</code>). See <a href="git-new -branch.html">git-new-branch(1)</a>
1062 for more features, such as the ability to track <em>LKGR</em>.</p></div>
1063 <div class="paragraph"><p>Commit as many changes as you like to this branch. Whe n you want to upload it
1064 for review, run:</p></div>
1065 <div class="listingblock">
1066 <div class="content">
1067 <pre><code><strong><span class="white">$ git cl upload</span></strong></code></p re>
1068 </div></div>
1069 <div class="paragraph"><p>This will take the diff of your branch against its ups tream (<code>origin/master</code>),
1070 and will post it to the <a href="https://codereview.chromium.org">Chromium code
1071 review site</a>.</p></div>
1072 </div>
1073 </div>
1074 <div class="sect1">
1075 <h2 id="_updating_the_code">UPDATING THE CODE</h2>
1076 <div class="sectionbody">
1077 <div class="paragraph"><p>Inevitably, you&#8217;ll want to pull in changes from the main Chromium repo. This is
1078 pretty easy with <em>depot_tools</em>:</p></div>
1079 <div class="listingblock">
1080 <div class="content">
1081 <pre><code><strong><span class="white">$ git rebase-update</span></strong></code ></pre>
1082 </div></div>
1083 <div class="paragraph"><p>This command will update all of your CLs to contain th e latest code from their
1084 upstreams. It will also automatically clean up CLs which have been committed and
1085 a couple other nice things. See <a href="git-rebase-update.html">git-rebase-upda te(1)</a> for the full
1086 scoop.</p></div>
1087 <div class="paragraph"><p>One thing to look out for are <em>merge conflicts</em> . These happen for exactly the
1088 same as they do with SVN, but the experience is a little more controllable with
1089 git. <code>git rebase-update</code> will try to rebase all your branches for you , but if it
1090 encounters a merge conflict in one, it will halt and leave you in a rebase
1091 conflict state (see <a href="git-rebase.html">git-rebase(1)</a>). Resolving <cod e>git rebase</code> merge
1092 conflicts is beyond the scope of this tutorial, but there are many good sources
1093 online (see the <a href="#_prerequisites">Prerequisites</a> for some).</p></div>
1094 <div class="paragraph"><p>Sometimes you&#8217;re pretty certain that you&#8217;v e committed a certain branch, but <code>git
1095 rebase-update</code> isn&#8217;t able to tell that for sure. This is usually bec ause your
1096 branch doesn&#8217;t rebase cleanly. You could just delete the branch with <code >git branch
1097 -D &lt;branch&gt;</code>, but you&#8217;d like to double check the diff of your branch against its
1098 upstream before deleting it. If this is the case you can abort the rebase
1099 started by <code>git rebase-update</code>, and then run <a href="git-squash-bran ch.html">git-squash-branch(1)</a> to
1100 flatten your branch into a single commit. When you run <code>git rebase-update</ code>
1101 again, you&#8217;ll get a (hopefully) much smaller / saner diff. If it turns out you
1102 were wrong about your branch being fully committed, you can use
1103 <a href="git-reflog.html">git-reflog(1)</a> to reset your branch back to where i t was before. If the
1104 diff looks inconsequential, you can use <code>git rebase --skip</code> to ignore it, and
1105 then <code>git rebase-update</code> will clean it up for you.</p></div>
1106 <div class="paragraph"><p>Once you&#8217;re done resolving all of the merge conf lict, just run <code>git
1107 rebase-update</code>, and it will pick up where it left off. Once the command ha s
1108 finished updating all of your branches, it will return you back to the branch
1109 you started on.</p></div>
1110 <div class="admonitionblock">
1111 <table><tr>
1112 <td class="icon">
1113 <div class="title">Note</div>
1114 </td>
1115 <td class="content">Running <code>git rebase-update</code> will update all your branches, but it will not
1116 automatically run <code>gclient sync</code> to update your dependencies.</td>
1117 </tr></table>
1118 </div>
1119 </div>
1120 </div>
1121 <div class="sect1">
1122 <h2 id="_managing_multiple_cls">MANAGING MULTIPLE CLS</h2>
1123 <div class="sectionbody">
1124 <div class="paragraph"><p>Sometimes you want to work on more than one CL at once (say, you have a CL
1125 posted for review and want to work on something else). For each CL that you
1126 want to work on, just use <code>git new-branch &lt;branchname&gt;</code>.</p></d iv>
1127 <div class="paragraph"><p>Once you start to have more than one CL at a time, it can be easy to lose your
1128 bearings. Fortunately, <em>depot_tools</em> has two tools to help you out:</p></ div>
1129 <div class="listingblock">
1130 <div class="content">
1131 <pre><code><strong><span class="white">$ git map</span></strong>
1132 <span class="white blue-background">*</span>&#8203;<strong><span class="blue-bac kground red"> 7dcfe47 </span></strong> <span class="green">(</span>&#8203; <strong><span class="aqua">frozen_changes</span></strong>&#8203;<span class="gre en">)</span> <span class="yellow">2014-03-12</span> ~ FREEZE.unindexed
1133 * <strong><span class="red">4b0c180</span></strong> <span class="yellow"> 2014-03-12</span> ~ modfile
1134 * <strong><span class="red">59a7cca</span></strong> <span class="yellow"> 2014-03-12</span> ~ a deleted file
1135 * <strong><span class="red">6bec695</span></strong> <span class="green">( </span>&#8203;<span class="red">origin/master</span>&#8203;<span class="green">) </span> <span class="yellow">2014-03-11</span> ~ Add neat feature <strong><sp an class="white">&lt;(frozen_changes)</span></strong>
1136 * <strong><span class="red">d15a38a</span></strong> <span class="yellow"> 2014-03-11</span> ~ Epic README update
1137 * <strong><span class="red">d559894</span></strong> <span class="green">( </span>&#8203;<strong><span class="lime">master</span></strong>&#8203;<span clas s="green">)</span> <span class="yellow">2014-03-11</span> ~ Important upstream c hange
1138 <span class="red">|</span> * <strong><span class="red">9c311fd</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">cool_feature</ span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-1 1</span> ~ Respond to CL comments
1139 <span class="red">|</span> <span class="green">|</span> * <strong><span class="r ed">2a1eeb2</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">subfeature</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ integrate with CoolService
1140 <span class="red">|</span> <span class="green">|</span> * <strong><span class="r ed">d777af6</span></strong> <span class="yellow">2014-03-11</span> ~ slick co mmenting action
1141 <span class="red">|</span> <span class="green">|/</span>
1142 <span class="red">|</span> * <strong><span class="red">265803a</span></strong> <span class="yellow">2014-03-11</span> ~ another improvement <strong><spa n class="white">&lt;(subfeature)</span></strong>
1143 <span class="red">|</span> * <strong><span class="red">6d831ac</span></strong> <span class="green">(</span>&#8203;<strong><span class="fuchsia">spleen_tag< /span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03- 11</span> ~ Refactor spleen
1144 <span class="red">|</span> * <strong><span class="red">82e74ab</span></strong> <span class="yellow">2014-03-11</span> ~ Add widget
1145 <span class="red">|/</span>
1146 * <strong><span class="red">d08c5b3</span></strong> <span class="green">( </span>&#8203;<strong><span class="lime">bogus_noparent</span></strong>&#8203;<s pan class="green">)</span> <span class="yellow">2014-03-11</span> ~ Wonderful be ginnings <strong><span class="white">&lt;(cool_feature)</span></strong></code ></pre>
1147 </div></div>
1148 <div class="paragraph"><p>Note that this example repo is in dire need of a <a hr ef="git-rebase-update.html">git-rebase-update(1)</a>!</p></div>
1149 <div class="listingblock">
1150 <div class="content">
1151 <pre><code><strong><span class="white">$ git map-branches</span></strong>
1152 <span class="red">origin/master</span>
1153 <span class="green">cool_feature</span>
1154 <span class="green">subfeature</span>
1155 <span class="aqua">frozen_changes *</span>
1156 <span class="green">master</span></code></pre>
1157 </div></div>
1158 <div class="dlist"><dl>
1159 <dt class="hdlist1">
1160 <a href="git-map.html">git-map(1)</a>
1161 </dt>
1162 <dd>
1011 <p> 1163 <p>
1012 This will pull all dependencies of the Chromium src checkout. You will need 1164 This tool shows you the history of all of your branches in a pseudo-graphical
1013 to run this any time you update the main src checkout. 1165 format. In particular, it will show you which commits all of your branches
1166 are on, which commit you currently have checked out, and more. Check out the
1167 doc for the full details.
1014 </p> 1168 </p>
1015 </li> 1169 </dd>
1016 </ol></div> 1170 <dt class="hdlist1">
1017 </div> 1171 <a href="git-map-branches.html">git-map-branches(1)</a>
1018 </div> 1172 </dt>
1019 <div class="sect1"> 1173 <dd>
1020 <h2 id="_tl_dr_walkthrough">TL;DR WALKTHROUGH</h2> 1174 <p>
1021 <div class="sectionbody"> 1175 This tool just shows you which branches you have in your repo, and thier
1022 <div class="paragraph"><p>This section will demo what a typical workflow looks l ike when writing, updating, 1176 upstream relationship to each other (as well as which branch you have checked
1023 and committing multiple CLs.</p></div> 1177 out at the moment).
1178 </p>
1179 </dd>
1180 </dl></div>
1181 <div class="paragraph"><p>Additionally, sometimes you need to switch between bra nches, but you&#8217;ve got work
1182 in progress. You could use <a href="git-stash.html">git-stash(1)</a>, but that c an be tricky to
1183 manage because you need to remember which branches you stashed what changes on.
1184 Helpfully <em>depot_tools</em> includes two tools which can greatly assist in ca se:</p></div>
1185 <div class="paragraph"><p><a href="git-freeze.html">git-freeze(1)</a> allows you to put the current branch in 'suspended
1186 animation' by committing your changes to a specially-named commit on the top of
1187 your current branch. When you come back to your branch later, you can just run
1188 <a href="git-thaw.html">git-thaw(1)</a> to get your work-in-progress changes bac k to what they were.</p></div>
1189 <div class="paragraph"><p>Another useful tool is <a href="git-rename-branch.html ">git-rename-branch(1)</a>. Unlike <code>git branch -m &lt;old&gt;
1190 &lt;new&gt;</code>, this tool will correctly preserve the upstream relationships of your
1191 branch compared to its downstreams.</p></div>
1192 <div class="paragraph"><p>Finally, take a look at <a href="git-upstream-diff.htm l">git-upstream-diff(1)</a>. This will show you the
1193 combined diff for all the commits on your branch against the upstream tracking
1194 branch. This is <em>exactly</em> what <code>git cl upload</code> will push up to code review.
1195 Additionally, consider trying the <code>--wordwise</code> argument to get a colo rized
1196 per-word diff (instead of a per-line diff).</p></div>
1197 </div>
1198 </div>
1199 <div class="sect1">
1200 <h2 id="_managing_dependent_cls">MANAGING DEPENDENT CLS</h2>
1201 <div class="sectionbody">
1202 <div class="paragraph"><p>Now that you know how to manage <em>independent</em> C Ls, we&#8217;ll see how to manage
1203 <em>dependent</em> CLs. Dependent CLs are useful when your second (or third or f ourth
1204 or &#8230;) CL depends on the changes in one of your other CLs (such as: CL 2 wo n&#8217;t
1205 compile without CL 1, but you want to submit them as two separate reviews).</p>< /div>
1206 <div class="paragraph"><p>Like all of the other CLs we&#8217;ve created, we use <a href="git-new-branch.html">git-new-branch(1)</a>, but
1207 this time with an extra argument. First, <code>git checkout</code> the branch
1208 you want to base the new one on (i.e. CL 1), and then run:</p></div>
1209 <div class="listingblock">
1210 <div class="content">
1211 <pre><code><strong><span class="white">$ git new-branch --upstream_current &lt;b ranch_name&gt;</span></strong></code></pre>
1212 </div></div>
1213 <div class="paragraph"><p>This will make a new branch which tracks the <em>curre nt</em> branch as its upstream
1214 (as opposed to <em>origin/master</em>). All changes you commit to this branch wi ll be
1215 in addition to the previous branch, but when you <code>git cl upload</code>, you will only
1216 upload the diff for the dependent (child) branch. You may have as many branches
1217 nested in this fashion as you like.</p></div>
1218 <div class="paragraph"><p><a href="git-map.html">git-map(1)</a> and <a href="git -map-branches.html">git-map-branches(1)</a> are particularly helpful when
1219 you have dependent branches. In addition, there are two helper commands which
1220 let you traverse your working copy up and down this tree of branches:
1221 <a href="git-nav-upstream.html">git-nav-upstream(1)</a> and <a href="git-nav-dow nstream.html">git-nav-downstream(1)</a>.</p></div>
1222 <div class="paragraph"><p>Sometimes when dealing with dependent CLs, it turns ou t that you accidentally
1223 based a branch on the wrong upstream, but since then you&#8217;ve committed chan ges to
1224 it, or even based <em>another</em> branch off of that one. Or you discover that you
1225 have two independent CLs that would actually be much better off as dependent
1226 CLs. In instances like these, you can check out the offending branch and use
1227 <a href="git-reparent-branch.html">git-reparent-branch(1)</a> to move it to trac k a different parent. Note that
1228 this can also be used to move a branch from tracking <code>origin/master</code> to <code>lkgr</code>
1229 or vice versa.</p></div>
1230 </div>
1231 </div>
1232 <div class="sect1">
1233 <h2 id="_example_walkthrough">EXAMPLE WALKTHROUGH</h2>
1234 <div class="sectionbody">
1235 <div class="paragraph"><p>This section will demo what a typical workflow looks l ike when writing,
1236 updating, and committing multiple CLs.</p></div>
1024 <div class="paragraph"><p></p></div><div class="listingblock"><div class="conten t"><pre><code><span style="font-weight: bold; color: #ffffff">$ fetch chromium</ span> 1237 <div class="paragraph"><p></p></div><div class="listingblock"><div class="conten t"><pre><code><span style="font-weight: bold; color: #ffffff">$ fetch chromium</ span>
1025 ... truncated output ... 1238 ... truncated output ...
1026 <span style="font-weight: bold; color: #ffffff">$ cd src</span> 1239 <span style="font-weight: bold; color: #ffffff">$ cd src</span>
1027 </code></pre></div></div><p><div class="paragraph"> (only on linux)</p></div><di v class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ ./build/install-build-deps.sh</span> 1240 </code></pre></div></div><p><div class="paragraph"> (only on linux)</p></div><di v class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ ./build/install-build-deps.sh</span>
1028 ... truncated output ... 1241 ... truncated output ...
1029 </code></pre></div></div><p><div class="paragraph"> Pull in all dependencies for HEAD</p></div><div class="listingblock"><div class="content"><pre><code><span s tyle="font-weight: bold; color: #ffffff">$ gclient sync</span> 1242 </code></pre></div></div><p><div class="paragraph"> Pull in all dependencies for HEAD</p></div><div class="listingblock"><div class="content"><pre><code><span s tyle="font-weight: bold; color: #ffffff">$ gclient sync</span>
1030 ... truncated output ... 1243 ... truncated output ...
1031 </code></pre></div></div><p><div class="paragraph"> Let's fix something!</p></di v><div class="listingblock"><div class="content"><pre><code><span style="font-we ight: bold; color: #ffffff">$ git new-branch fix_typo</span> 1244 </code></pre></div></div><p><div class="paragraph"> Let's fix something!</p></di v><div class="listingblock"><div class="content"><pre><code><span style="font-we ight: bold; color: #ffffff">$ git new-branch fix_typo</span>
1032 <span style="font-weight: bold; color: #ffffff">$ echo -e '/Banana\ns/Banana/Kuu n\nwq' | ed build/whitespace_file.txt</span> 1245 <span style="font-weight: bold; color: #ffffff">$ echo -e '/Banana\ns/Banana/Kuu n\nwq' | ed build/whitespace_file.txt</span>
1033 1503 1246 1503
1034 It was a Domo-Banana. 1247 It was a Domo-Banana.
1035 It was a Domo-Kuun. 1248 It was a Domo-Kuun.
1036 1501 1249 1501
1037 <span style="font-weight: bold; color: #ffffff">$ git commit -am 'Fix terrible t ypo.'</span> 1250 <span style="font-weight: bold; color: #ffffff">$ git commit -am 'Fix terrible t ypo.'</span>
1038 [fix_typo 615ffa7] Fix terrible typo. 1251 [fix_typo 615ffa7] Fix terrible typo.
1039 1 file changed, 1 insertion(+), 1 deletion(-) 1252 1 file changed, 1 insertion(+), 1 deletion(-)
1040 <span style="font-weight: bold; color: #ffffff">$ git map</span> 1253 <span style="font-weight: bold; color: #ffffff">$ git map</span>
1041 <span style="background-color: #492ee1"></span><span style="font-weight: bold; b ackground-color: #492ee1">* </span><span style="font-weight: bold; color: #e42e1 6; background-color: #492ee1">615ffa7 </span><span style="color: #19c518"> (</ span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5">fix_typo</span><span style="font-weight: bold"></span><span style="font -weight: bold"></span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo. 1254 <span style="background-color: #492ee1"></span><span style="font-weight: bold; b ackground-color: #492ee1">* </span><span style="font-weight: bold; color: #e42e1 6; background-color: #492ee1">615ffa7 </span><span style="color: #19c518"> (</ span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5">fix_typo</span><span style="font-weight: bold"></span><span style="font -weight: bold"></span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
1042 * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span sty le="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><s pan style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</sp an><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10 </span> ~ Make ReflectorImpl use mailboxes<span style="font-weight: bold"></span ><span style="font-weight: bold; color: #ffffff"> &lt;(fix_typo)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span> 1255 * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span sty le="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><s pan style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</sp an><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10 </span> ~ Make ReflectorImpl use mailboxes<span style="font-weight: bold"></span ><span style="font-weight: bold; color: #ffffff"> &lt;(fix_typo)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
1043 * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don 't use glibc-specific execinfo.h on uclibc builds 1256 * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don 't use glibc-specific execinfo.h on uclibc builds
1044 * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fs p] Add requestUnmount() method together with the request manager. 1257 * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fs p] Add requestUnmount() method together with the request manager.
1045 * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ lin ux_aura: Use system configuration for middle clicking the titlebar. 1258 * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ lin ux_aura: Use system configuration for middle clicking the titlebar.
1046 * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Con tentView-&gt;ContentViewCore in ContentViewRenderView 1259 * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Con tentView-&gt;ContentViewCore in ContentViewRenderView
1047 * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozo ne: evdev: Filter devices by path 1260 * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozo ne: evdev: Filter devices by path
1048 * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Alw ays output seccomp error messages to stderr 1261 * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Alw ays output seccomp error messages to stderr
1049 <span style="font-weight: bold; color: #ffffff">$ git status</span> 1262 <span style="font-weight: bold; color: #ffffff">$ git status</span>
1050 # On branch fix_typo 1263 On branch fix_typo
1051 # Your branch is ahead of 'origin/master' by 1 commit. 1264 Your branch is ahead of 'origin/master' by 1 commit.
1052 # (use "git push" to publish your local commits) 1265 (use "git push" to publish your local commits)
1053 # 1266
1054 nothing to commit, working directory clean 1267 nothing to commit, working directory clean
1055 <span style="font-weight: bold; color: #ffffff">$ git cl upload -r domo@chromium .org --send-mail</span> 1268 <span style="font-weight: bold; color: #ffffff">$ git cl upload -r domo@chromium .org --send-mail</span>
1056 ... truncated output ... 1269 ... truncated output ...
1057 </code></pre></div></div><p><div class="paragraph"> While we wait for feedback, let's do something else.</p></div><div class="listingblock"><div class="content" ><pre><code><span style="font-weight: bold; color: #ffffff">$ git new-branch cha p2</span> 1270 </code></pre></div></div><p><div class="paragraph"> While we wait for feedback, let's do something else.</p></div><div class="listingblock"><div class="content" ><pre><code><span style="font-weight: bold; color: #ffffff">$ git new-branch cha p2</span>
1058 <span style="font-weight: bold; color: #ffffff">$ git map-branches</span> 1271 <span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
1059 <span style="color: #e42e16"></span><span style="font-weight: bold; color: #e42e 16">origin/master 1272 <span style="color: #e42e16"></span><span style="font-weight: bold; color: #e42e 16">origin/master
1060 </span><span style="font-weight: bold; color: #33d6e5"></span><span style="font- weight: bold; color: #33d6e5"> chap2 * 1273 </span><span style="font-weight: bold; color: #33d6e5"></span><span style="font- weight: bold; color: #33d6e5"> chap2 *
1061 </span><span style="font-weight: bold; color: #19c518"></span><span style="color : #19c518"> fix_typo 1274 </span><span style="font-weight: bold; color: #19c518"></span><span style="color : #19c518"> fix_typo
1062 </span><span style="font-weight: bold; color: #ffffff">$ cat &gt;&gt; build/whit espace_file.txt &lt;&lt;EOF</span> 1275 </span><span style="font-weight: bold; color: #ffffff">$ cat &gt;&gt; build/whit espace_file.txt &lt;&lt;EOF</span>
1063 1276
1064 "You recall what happened on Mulholland drive?" The ceiling fan rotated slowly 1277 "You recall what happened on Mulholland drive?" The ceiling fan rotated slowly
1065 overhead, barely disturbing the thick cigarette smoke. No doubt was left about 1278 overhead, barely disturbing the thick cigarette smoke. No doubt was left about
1066 when the fan was last cleaned. 1279 when the fan was last cleaned.
1067 EOF 1280 EOF
1068 <span style="font-weight: bold; color: #ffffff">$ git status</span> 1281 <span style="font-weight: bold; color: #ffffff">$ git status</span>
1069 # On branch chap2 1282 On branch chap2
1070 # Your branch is up-to-date with 'origin/master'. 1283 Your branch is up-to-date with 'origin/master'.
1071 # 1284
1072 # Changes not staged for commit: 1285 Changes not staged for commit:
1073 # (use "git add &lt;file&gt;..." to update what will be committed) 1286 (use "git add &lt;file&gt;..." to update what will be committed)
1074 # (use "git checkout -- &lt;file&gt;..." to discard changes in working directo ry) 1287 (use "git checkout -- &lt;file&gt;..." to discard changes in working directory )
1075 # 1288
1076 #» <span style="color: #e42e16">modified: build/whitespace_file.txt</span > 1289 » <span style="color: #e42e16">modified: build/whitespace_file.txt</span >
1077 # 1290
1078 no changes added to commit (use "git add" and/or "git commit -a") 1291 no changes added to commit (use "git add" and/or "git commit -a")
1079 </code></pre></div></div><p><div class="paragraph"> Someone on the code review p ointed out that our typo-fix has a typo :( We're still working on 'chap2' but we really want to land 'fix_typo', so let's switch over and fix it.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: b old; color: #ffffff">$ git freeze</span> 1292 </code></pre></div></div><p><div class="paragraph"> Someone on the code review p ointed out that our typo-fix has a typo :( We're still working on 'chap2' but we really want to land 'fix_typo', so let's switch over and fix it.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: b old; color: #ffffff">$ git freeze</span>
1080 <span style="font-weight: bold; color: #ffffff">$ git checkout fix_typo</span> 1293 <span style="font-weight: bold; color: #ffffff">$ git checkout fix_typo</span>
1081 Switched to branch 'fix_typo' 1294 Switched to branch 'fix_typo'
1082 Your branch is ahead of 'origin/master' by 1 commit. 1295 Your branch is ahead of 'origin/master' by 1 commit.
1083 (use "git push" to publish your local commits) 1296 (use "git push" to publish your local commits)
1084 <span style="font-weight: bold; color: #ffffff">$ echo -e '/Kuun\ns/Kuun/Kun\nwq ' | ed build/whitespace_file.txt</span> 1297 <span style="font-weight: bold; color: #ffffff">$ echo -e '/Kuun\ns/Kuun/Kun\nwq ' | ed build/whitespace_file.txt</span>
1085 1501 1298 1501
1086 It was a Domo-Kuun. 1299 It was a Domo-Kuun.
1087 It was a Domo-Kun. 1300 It was a Domo-Kun.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Alw ays output seccomp error messages to stderr 1525 * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span sty le="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Alw ays output seccomp error messages to stderr
1313 <span style="font-weight: bold; color: #ffffff">$ git cl upload</span> 1526 <span style="font-weight: bold; color: #ffffff">$ git cl upload</span>
1314 ... truncated output ... 1527 ... truncated output ...
1315 </code></pre></div></div><p><div class="paragraph"></p></div> 1528 </code></pre></div></div><p><div class="paragraph"></p></div>
1316 <div class="paragraph"><p>So there you have the basic flow. Note that you don&#8 217;t <em>have</em> to do chromium 1529 <div class="paragraph"><p>So there you have the basic flow. Note that you don&#8 217;t <em>have</em> to do chromium
1317 development using these tools. Any git workflow is compatible, as long as 1530 development using these tools. Any git workflow is compatible, as long as
1318 <code>git cl upload</code> is able to upload good patches.</p></div> 1531 <code>git cl upload</code> is able to upload good patches.</p></div>
1319 </div> 1532 </div>
1320 </div> 1533 </div>
1321 <div class="sect1"> 1534 <div class="sect1">
1322 <h2 id="_creating_uploading_a_cl">CREATING / UPLOADING A CL</h2>
1323 <div class="sectionbody">
1324 <div class="admonitionblock">
1325 <table><tr>
1326 <td class="icon">
1327 <div class="title">Note</div>
1328 </td>
1329 <td class="content">The remainder of the tutorial assumes that your current work ing directory
1330 is the <code>src/</code> folder mentioned in <a href="#_getting_the_code">Gettin g the code</a>.</td>
1331 </tr></table>
1332 </div>
1333 <div class="paragraph"><p>Each CL corresponds exactly with a single branch in gi t. Any time you want to
1334 begin a new CL, just:</p></div>
1335 <div class="listingblock">
1336 <div class="content">
1337 <pre><code><strong><span class="white">$ git new-branch &lt;branch_name&gt;</spa n></strong></code></pre>
1338 </div></div>
1339 <div class="paragraph"><p>This will create and checkout a new branch named <code >branch_name</code> which will track
1340 the default upstream (which is <code>origin/master</code>). See <a href="git-new -branch.html">git-new-branch(1)</a>
1341 for more features, such as the ability to track <em>LKGR</em>.</p></div>
1342 <div class="paragraph"><p>Commit as many changes as you like to this branch. Whe n you want to upload it
1343 for review, run:</p></div>
1344 <div class="listingblock">
1345 <div class="content">
1346 <pre><code><strong><span class="white">$ git cl upload</span></strong></code></p re>
1347 </div></div>
1348 <div class="paragraph"><p>This will take the diff of your branch against its ups tream (<code>origin/master</code>),
1349 and will post it to the <a href="https://codereview.chromium.org">Chromium code
1350 review site</a>.</p></div>
1351 </div>
1352 </div>
1353 <div class="sect1">
1354 <h2 id="_updating_the_code">UPDATING THE CODE</h2>
1355 <div class="sectionbody">
1356 <div class="paragraph"><p>Inevitably, you&#8217;ll want to pull in changes from the main Chromium repo. This is
1357 pretty easy with <em>depot_tools</em>:</p></div>
1358 <div class="listingblock">
1359 <div class="content">
1360 <pre><code><strong><span class="white">$ git rebase-update</span></strong></code ></pre>
1361 </div></div>
1362 <div class="paragraph"><p>This command will update all of your CLs to contain th e latest code from their
1363 upstreams. It will also automatically clean up CLs which have been committed and
1364 a couple other nice things. See <a href="git-rebase-update.html">git-rebase-upda te(1)</a> for the full
1365 scoop.</p></div>
1366 <div class="paragraph"><p>One thing to look out for are <em>merge conflicts</em> . These happen for exactly the
1367 same as they do with SVN, but the experience is a little more controllable with
1368 git. <code>git rebase-update</code> will try to rebase all your branches for you , but if it
1369 encounters a merge conflict in one, it will halt and leave you in a rebase
1370 conflict state (see <a href="git-rebase.html">git-rebase(1)</a>). Resolving <cod e>git rebase</code> merge
1371 conflicts is beyond the scope of this tutorial, but there are many good sources
1372 online (see the <a href="#_prerequisites">Prerequisites</a> for some).</p></div>
1373 <div class="paragraph"><p>Sometimes you&#8217;re pretty certain that you&#8217;v e committed a certain branch, but <code>git
1374 rebase-update</code> isn&#8217;t able to tell that for sure. This is usually bec ause your
1375 branch doesn&#8217;t rebase cleanly. You could just delete the branch with <code >git branch
1376 -D &lt;branch&gt;</code>, but you&#8217;d like to double check the diff of your branch against its
1377 upstream before deleting it. If this is the case you can abort the rebase
1378 started by <code>git rebase-update</code>, and then run <a href="git-squash-bran ch.html">git-squash-branch(1)</a> to
1379 flatten your branch into a single commit. When you run <code>git rebase-update</ code>
1380 again, you&#8217;ll get a (hopefully) much smaller / saner diff. If it turns out you
1381 were wrong about your branch being fully committed, you can use
1382 <a href="git-reflog.html">git-reflog(1)</a> to reset your branch back to where i t was before. If the
1383 diff looks inconsequential, you can use <code>git rebase --skip</code> to ignore it, and
1384 then <code>git rebase-update</code> will clean it up for you.</p></div>
1385 <div class="paragraph"><p>Once you&#8217;re done resolving all of the merge conf lict, just run <code>git
1386 rebase-update</code>, and it will pick up where it left off. Once the command ha s
1387 finished updating all of your branches, it will return you back to the branch
1388 you started on.</p></div>
1389 <div class="admonitionblock">
1390 <table><tr>
1391 <td class="icon">
1392 <div class="title">Note</div>
1393 </td>
1394 <td class="content">Running <code>git rebase-update</code> will update all your branches, but it will not
1395 automatically run <code>gclient sync</code> to update your dependencies.</td>
1396 </tr></table>
1397 </div>
1398 </div>
1399 </div>
1400 <div class="sect1">
1401 <h2 id="_managing_multiple_cls">MANAGING MULTIPLE CLS</h2>
1402 <div class="sectionbody">
1403 <div class="paragraph"><p>Sometimes you want to work on more than one CL at once (say, you have a CL
1404 posted for review and want to work on something else). For each CL that you
1405 want to work on, just use <code>git new-branch &lt;branchname&gt;</code>.</p></d iv>
1406 <div class="paragraph"><p>Once you start to have more than one CL at a time, it can be easy to lose your
1407 bearings. Fortunately, <em>depot_tools</em> has two tools to help you out:</p></ div>
1408 <div class="listingblock">
1409 <div class="content">
1410 <pre><code><strong><span class="white">$ git map</span></strong>
1411 <span class="white blue-background">*</span>&#8203;<strong><span class="blue-bac kground red"> 7dcfe47 </span></strong> <span class="green">(</span>&#8203; <strong><span class="aqua">frozen_changes</span></strong>&#8203;<span class="gre en">)</span> <span class="yellow">2014-03-12</span> ~ FREEZE.unindexed
1412 * <strong><span class="red">4b0c180</span></strong> <span class="yellow"> 2014-03-12</span> ~ modfile
1413 * <strong><span class="red">59a7cca</span></strong> <span class="yellow"> 2014-03-12</span> ~ a deleted file
1414 * <strong><span class="red">6bec695</span></strong> <span class="green">( </span>&#8203;<span class="red">origin/master</span>&#8203;<span class="green">) </span> <span class="yellow">2014-03-11</span> ~ Add neat feature <strong><sp an class="white">&lt;(frozen_changes)</span></strong>
1415 * <strong><span class="red">d15a38a</span></strong> <span class="yellow"> 2014-03-11</span> ~ Epic README update
1416 * <strong><span class="red">d559894</span></strong> <span class="green">( </span>&#8203;<strong><span class="lime">master</span></strong>&#8203;<span clas s="green">)</span> <span class="yellow">2014-03-11</span> ~ Important upstream c hange
1417 <span class="red">|</span> * <strong><span class="red">9c311fd</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">cool_feature</ span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-1 1</span> ~ Respond to CL comments
1418 <span class="red">|</span> <span class="green">|</span> * <strong><span class="r ed">2a1eeb2</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">subfeature</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ integrate with CoolService
1419 <span class="red">|</span> <span class="green">|</span> * <strong><span class="r ed">d777af6</span></strong> <span class="yellow">2014-03-11</span> ~ slick co mmenting action
1420 <span class="red">|</span> <span class="green">|/</span>
1421 <span class="red">|</span> * <strong><span class="red">265803a</span></strong> <span class="yellow">2014-03-11</span> ~ another improvement <strong><spa n class="white">&lt;(subfeature)</span></strong>
1422 <span class="red">|</span> * <strong><span class="red">6d831ac</span></strong> <span class="green">(</span>&#8203;<strong><span class="fuchsia">spleen_tag< /span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03- 11</span> ~ Refactor spleen
1423 <span class="red">|</span> * <strong><span class="red">82e74ab</span></strong> <span class="yellow">2014-03-11</span> ~ Add widget
1424 <span class="red">|/</span>
1425 * <strong><span class="red">d08c5b3</span></strong> <span class="green">( </span>&#8203;<strong><span class="lime">bogus_noparent</span></strong>&#8203;<s pan class="green">)</span> <span class="yellow">2014-03-11</span> ~ Wonderful be ginnings <strong><span class="white">&lt;(cool_feature)</span></strong></code ></pre>
1426 </div></div>
1427 <div class="paragraph"><p>Note that this example repo is in dire need of a <a hr ef="git-rebase-update.html">git-rebase-update(1)</a>!</p></div>
1428 <div class="listingblock">
1429 <div class="content">
1430 <pre><code><strong><span class="white">$ git map-branches</span></strong>
1431 <span class="red">origin/master</span>
1432 <span class="green">cool_feature</span>
1433 <span class="green">subfeature</span>
1434 <span class="aqua">frozen_changes *</span>
1435 <span class="green">master</span></code></pre>
1436 </div></div>
1437 <div class="dlist"><dl>
1438 <dt class="hdlist1">
1439 <a href="git-map.html">git-map(1)</a>
1440 </dt>
1441 <dd>
1442 <p>
1443 This tool shows you the history of all of your branches in a pseudo-graphical
1444 format. In particular, it will show you which commits all of your branches
1445 are on, which commit you currently have checked out, and more. Check out the
1446 doc for the full details.
1447 </p>
1448 </dd>
1449 <dt class="hdlist1">
1450 <a href="git-map-branches.html">git-map-branches(1)</a>
1451 </dt>
1452 <dd>
1453 <p>
1454 This tool just shows you which branches you have in your repo, and thier
1455 upstream relationship to each other (as well as which branch you have checked
1456 out at the moment).
1457 </p>
1458 </dd>
1459 </dl></div>
1460 <div class="paragraph"><p>Additionally, sometimes you need to switch between bra nches, but you&#8217;ve got work
1461 in progress. You could use <a href="git-stash.html">git-stash(1)</a>, but that c an be tricky to
1462 manage because you need to remember which branches you stashed what changes on.
1463 Helpfully <em>depot_tools</em> includes two tools which can greatly assist in ca se:</p></div>
1464 <div class="paragraph"><p><a href="git-freeze.html">git-freeze(1)</a> allows you to put the current branch in 'suspended
1465 animation' by committing your changes to a specially-named commit on the top of
1466 your current branch. When you come back to your branch later, you can just run
1467 <a href="git-thaw.html">git-thaw(1)</a> to get your work-in-progress changes bac k to what they were.</p></div>
1468 <div class="paragraph"><p>Another useful tool is <a href="git-rename-branch.html ">git-rename-branch(1)</a>. Unlike <code>git branch -m &lt;old&gt;
1469 &lt;new&gt;</code>, this tool will correctly preserve the upstream relationships of your
1470 branch compared to its downstreams.</p></div>
1471 <div class="paragraph"><p>Finally, take a look at <a href="git-upstream-diff.htm l">git-upstream-diff(1)</a>. This will show you the
1472 combined diff for all the commits on your branch against the upstream tracking
1473 branch. This is <em>exactly</em> what <code>git cl upload</code> will push up to code review.
1474 Additionally, consider trying the <code>--wordwise</code> argument to get a colo rized
1475 per-word diff (instead of a per-line diff).</p></div>
1476 </div>
1477 </div>
1478 <div class="sect1">
1479 <h2 id="_managing_dependent_cls">MANAGING DEPENDENT CLS</h2>
1480 <div class="sectionbody">
1481 <div class="paragraph"><p>Now that you know how to manage <em>independent</em> C Ls, we&#8217;ll see how to manage
1482 <em>dependent</em> CLs. Dependent CLs are useful when your second (or third or f ourth
1483 or &#8230;) CL depends on the changes in one of your other CLs (such as: CL 2 wo n&#8217;t
1484 compile without CL 1, but you want to submit them as two separate reviews).</p>< /div>
1485 <div class="paragraph"><p>Like all of the other CLs we&#8217;ve created, we use <a href="git-new-branch.html">git-new-branch(1)</a>, but
1486 this time with an extra argument. First, <code>git checkout</code> the branch
1487 you want to base the new one on (i.e. CL 1), and then run:</p></div>
1488 <div class="listingblock">
1489 <div class="content">
1490 <pre><code><strong><span class="white">$ git new-branch --upstream_current &lt;b ranch_name&gt;</span></strong></code></pre>
1491 </div></div>
1492 <div class="paragraph"><p>This will make a new branch which tracks the <em>curre nt</em> branch as its upstream
1493 (as opposed to <em>origin/master</em>). All changes you commit to this branch wi ll be
1494 in addition to the previous branch, but when you <code>git cl upload</code>, you will only
1495 upload the diff for the dependent (child) branch. You may have as many branches
1496 nested in this fashion as you like.</p></div>
1497 <div class="paragraph"><p><a href="git-map.html">git-map(1)</a> and <a href="git -map-branches.html">git-map-branches(1)</a> are particularly helpful when
1498 you have dependent branches. In addition, there are two helper commands which
1499 let you traverse your working copy up and down this tree of branches:
1500 <a href="git-nav-upstream.html">git-nav-upstream(1)</a> and <a href="git-nav-dow nstream.html">git-nav-downstream(1)</a>.</p></div>
1501 <div class="paragraph"><p>Sometimes when dealing with dependent CLs, it turns ou t that you accidentally
1502 based a branch on the wrong upstream, but since then you&#8217;ve committed chan ges to
1503 it, or even based <em>another</em> branch off of that one. Or you discover that you
1504 have two independent CLs that would actually be much better off as dependent
1505 CLs. In instances like these, you can check out the offending branch and use
1506 <a href="git-reparent-branch.html">git-reparent-branch(1)</a> to move it to trac k a different parent. Note that
1507 this can also be used to move a branch from tracking <code>origin/master</code> to <code>lkgr</code>
1508 or vice versa.</p></div>
1509 </div>
1510 </div>
1511 <div class="sect1">
1512 <h2 id="_conclusion">CONCLUSION</h2> 1535 <h2 id="_conclusion">CONCLUSION</h2>
1513 <div class="sectionbody"> 1536 <div class="sectionbody">
1514 <div class="paragraph"><p>Hopefully that gives you a good starting overview on C hromium development using 1537 <div class="paragraph"><p>Hopefully that gives you a good starting overview on C hromium development using
1515 <em>depot_tools</em>. If you have questions which weren&#8217;t answered by this tutorial or 1538 <em>depot_tools</em>. If you have questions which weren&#8217;t answered by this tutorial or
1516 the man pages for the tools (see the index of all tools here: 1539 the man pages for the tools (see the index of all tools here:
1517 <a href="depot_tools.html">depot_tools(7)</a>), please feel free to ask.</p></di v> 1540 <a href="depot_tools.html">depot_tools(7)</a>), please feel free to ask.</p></di v>
1518 </div> 1541 </div>
1519 </div> 1542 </div>
1520 <div class="sect1"> 1543 <div class="sect1">
1521 <h2 id="_glossary">GLOSSARY</h2> 1544 <h2 id="_glossary">GLOSSARY</h2>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 <div class="sectionbody"> 1580 <div class="sectionbody">
1558 <div class="paragraph"><p>Part of the chromium <a href="depot_tools.html">depot_ tools(7)</a> suite. These tools are meant to 1581 <div class="paragraph"><p>Part of the chromium <a href="depot_tools.html">depot_ tools(7)</a> suite. These tools are meant to
1559 assist with the development of chromium and related projects. Download the tools 1582 assist with the development of chromium and related projects. Download the tools
1560 from <a href="https://chromium.googlesource.com/chromium/tools/depot_tools.git"> here</a>.</p></div> 1583 from <a href="https://chromium.googlesource.com/chromium/tools/depot_tools.git"> here</a>.</p></div>
1561 </div> 1584 </div>
1562 </div> 1585 </div>
1563 </div> 1586 </div>
1564 <div id="footnotes"><hr /></div> 1587 <div id="footnotes"><hr /></div>
1565 <div id="footer"> 1588 <div id="footer">
1566 <div id="footer-text"> 1589 <div id="footer-text">
1567 Last updated 2014-04-10 21:30:33 PDT 1590 Last updated 2014-04-14 16:26:14 PDT
1568 </div> 1591 </div>
1569 </div> 1592 </div>
1570 </body> 1593 </body>
1571 </html> 1594 </html>
OLDNEW
« no previous file with comments | « no previous file | docs/man7/depot_tools_tutorial.7 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698