1 <html devsite><head> 2 <title></title> 3 <meta name="project_path" value="/_project.yaml"/> 4 <meta name="book_path" value="/_book.yaml"/> 5 </head> 6 <body> 7 <!-- 8 Copyright 2017 The Android Open Source Project 9 10 Licensed under the Apache License, Version 2.0 (the "License"); 11 you may not use this file except in compliance with the License. 12 You may obtain a copy of the License at 13 14 http://www.apache.org/licenses/LICENSE-2.0 15 16 Unless required by applicable law or agreed to in writing, software 17 distributed under the License is distributed on an "AS IS" BASIS, 18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 See the License for the specific language governing permissions and 20 limitations under the License. 21 --> 22 23 <p> Android Git Repo Git Repo Repo Git Repo </p> 24 <p><strong>Git</strong> Android Git Android - (OEM) Android Git</p> 25 <p><strong>Repo</strong> Git Repo Git <a href="https://android-review.googlesource.com/"></a> Android Repo Git Android GitRepo Python Android Repo Repo </p> 26 <p><strong>Gerrit</strong> Git Gerrit GitGerrit </p> 27 <p><strong>Android Studio</strong> Android (IDE) <a href="http://developer.android.com/tools/studio/index.html">Android Studio </a> 28 29 </p><h2 id="basic-workflow"></h2> 30 <div class="attempt-right" style="width:200px"> 31 <img src="/images/submit-patches-0.png" alt="" height="153px"/> 32 <p class="img-caption"> 33 <strong> 1.</strong> Android </p> 34 </div> 35 36 <p></p> 37 <ol> 38 <li> 39 <p> <code>repo start</code> </p> 40 </li> 41 <li> 42 <p></p> 43 </li> 44 <li> 45 <p> <code>git add</code> </p> 46 </li> 47 <li> 48 <p> <code>git commit</code> </p> 49 </li> 50 <li> 51 <p> <code>repo upload</code> </p> 52 </li> 53 </ol> 54 <h2 id="task-reference"></h2> 55 <p> Repo Git Repo <a href="/source/downloading.html"></a><a href="/source/using-repo.html"> Repo</a></p> 56 <h2 id="synchronizing-your-client"></h2> 57 <p></p> 58 <pre><code>$ repo sync 59 </code></pre> 60 <p></p> 61 <pre><code>$ repo sync PROJECT0 PROJECT1 PROJECT2 ... 62 </code></pre> 63 <h2 id="creating-topic-branches"></h2> 64 <p><a href="http://www.kernel.org/pub/software/scm/git/docs/howto/separating-topic-branches.txt"></a></p> 65 <p> Repo </p> 66 <pre><code>$ repo start BRANCH_NAME . 67 </code></pre> 68 <p></p> 69 <pre><code>$ repo status . 70 </code></pre> 71 <h2 id="using-topic-branches"></h2> 72 <p></p> 73 <pre><code>$ repo start BRANCH_NAME PROJECT_NAME 74 </code></pre> 75 <p> <a href="https://android.googlesource.com/">android.googlesource.com</a></p> 76 77 <p></p> 78 <pre><code>$ git checkout BRANCH_NAME 79 </code></pre> 80 <p></p> 81 <pre><code>$ git branch 82 </code></pre> 83 <p></p> 84 <pre><code>$ repo branches 85 </code></pre> 86 <p></p> 87 <p class="note"><strong></strong> <code>repo sync</code> <code>repo sync</code> <code>git branch</code> * <code>git checkout</code></p> 88 <h2 id="staging-files"></h2> 89 <p>Git Git </p> 90 <p></p> 91 <pre><code>git add 92 </code></pre> 93 <p><code>git add</code> Git </p> 94 <h2 id="viewing-client-status"></h2> 95 <p></p> 96 <pre><code>$ repo status 97 </code></pre> 98 <p></p> 99 <pre><code>$ repo diff 100 </code></pre> 101 <p> <code>repo diff</code> <em></em> Git <code>git diff</code></p> 102 <pre><code>$ cd ~/WORKING_DIRECTORY/PROJECT 103 $ git diff --cached 104 </code></pre> 105 <h2 id="committing-changes"></h2> 106 <p> Git Git </p> 107 <pre><code>git commit 108 </code></pre> 109 <p> AOSP </p> 110 <h2 id="uploading-changes-to-gerrit"> Gerrit</h2> 111 <p></p> 112 <pre><code>repo sync 113 </code></pre> 114 <p></p> 115 <pre><code>repo upload 116 </code></pre> 117 <p> <code>y/n</code> </p> 118 <h2 id="recovering-sync-conflicts"></h2> 119 <p> <code>repo sync</code> </p> 120 <ul> 121 <li> = U</li> 122 <li></li> 123 <li> 124 <p> <code>git add</code> <code>git commit</code>(rebase) </p> 125 <pre><code>$ git add . 126 $ git commit 127 $ git rebase --continue 128 </code></pre> 129 </li> 130 <li> 131 <p></p> 132 <pre><code>$ repo sync PROJECT0 PROJECT1 ... PROJECTN 133 </code></pre> 134 </li> 135 </ul> 136 <h2 id="cleaning-up-your-client-files"></h2> 137 <p> Gerrit </p> 138 <pre><code>$ repo sync 139 </code></pre> 140 <p></p> 141 <pre><code>$ repo prune 142 </code></pre> 143 <h2 id="deleting-a-client"></h2> 144 <p></p> 145 <pre><code>$ rm -rf WORKING_DIRECTORY 146 </code></pre> 147 <p><em></em></p> 148 <h2 id="git-and-repo-cheatsheet">Git Repo </h2> 149 <img src="/images/git-repo-1.png" alt=" Git Repo " id="figure2"/> 150 <p class="img-caption"> 151 <strong> 2.</strong> Git Repo </p> 152 153 </body></html>