blob: fd96b30cde7ce0cae39d29e32c447363eec7eb14 [file] [log] [blame]
Eric Parkc9931992019-07-29 13:10:53 +09001
2
3
4
5<!doctype html>
6<html lang="en" class="no-js">
7 <head>
8
9 <meta charset="utf-8">
10 <meta name="viewport" content="width=device-width,initial-scale=1">
11 <meta http-equiv="x-ua-compatible" content="ie=edge">
12
13
14
15
16 <meta name="lang:clipboard.copy" content="Copy to clipboard">
17
18 <meta name="lang:clipboard.copied" content="Copied to clipboard">
19
20 <meta name="lang:search.language" content="en">
21
22 <meta name="lang:search.pipeline.stopwords" content="True">
23
24 <meta name="lang:search.pipeline.trimmer" content="True">
25
26 <meta name="lang:search.result.none" content="No matching documents">
27
28 <meta name="lang:search.result.one" content="1 matching document">
29
30 <meta name="lang:search.result.other" content="# matching documents">
31
32 <meta name="lang:search.tokenizer" content="[\s\-]+">
33
34 <link rel="shortcut icon" href="../../assets/images/favicon.png">
35 <meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.4.0">
36
37
38
39 <title>Git Started - Team Bliss</title>
40
41
42
43 <link rel="stylesheet" href="../../assets/stylesheets/application.0284f74d.css">
44
45
46
47
48 <script src="../../assets/javascripts/modernizr.74668098.js"></script>
49
50
51
52 <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
53 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono&display=fallback">
54 <style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
55
56
57 <link rel="stylesheet" href="../../assets/fonts/material-icons.css">
58
59
60
61
62
63
64 </head>
65
66 <body dir="ltr">
67
68 <svg class="md-svg">
69 <defs>
70
71
72 </defs>
73 </svg>
74 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
75 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
76 <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
77
78 <a href="#git-started" tabindex="1" class="md-skip">
79 Skip to content
80 </a>
81
82
83 <header class="md-header" data-md-component="header">
84 <nav class="md-header-nav md-grid">
85 <div class="md-flex">
86 <div class="md-flex__cell md-flex__cell--shrink">
87 <a href="../.." title="Team Bliss" class="md-header-nav__button md-logo">
88
89 <i class="md-icon"></i>
90
91 </a>
92 </div>
93 <div class="md-flex__cell md-flex__cell--shrink">
94 <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
95 </div>
96 <div class="md-flex__cell md-flex__cell--stretch">
97 <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
98
99 <span class="md-header-nav__topic">
100 Team Bliss
101 </span>
102 <span class="md-header-nav__topic">
103
104 Git Started
105
106 </span>
107
108 </div>
109 </div>
110 <div class="md-flex__cell md-flex__cell--shrink">
111
112 <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
113
114<div class="md-search" data-md-component="search" role="dialog">
115 <label class="md-search__overlay" for="__search"></label>
116 <div class="md-search__inner" role="search">
117 <form class="md-search__form" name="search">
118 <input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
119 <label class="md-icon md-search__icon" for="__search"></label>
120 <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
121 &#xE5CD;
122 </button>
123 </form>
124 <div class="md-search__output">
125 <div class="md-search__scrollwrap" data-md-scrollfix>
126 <div class="md-search-result" data-md-component="result">
127 <div class="md-search-result__meta">
128 Type to start searching
129 </div>
130 <ol class="md-search-result__list"></ol>
131 </div>
132 </div>
133 </div>
134 </div>
135</div>
136
137 </div>
138
139 </div>
140 </nav>
141</header>
142
143 <div class="md-container">
144
145
146
147
148 <main class="md-main">
149 <div class="md-main__inner md-grid" data-md-component="container">
150
151
152 <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
153 <div class="md-sidebar__scrollwrap">
154 <div class="md-sidebar__inner">
155 <nav class="md-nav md-nav--primary" data-md-level="0">
156 <label class="md-nav__title md-nav__title--site" for="__drawer">
157 <a href="../.." title="Team Bliss" class="md-nav__button md-logo">
158
159 <i class="md-icon"></i>
160
161 </a>
162 Team Bliss
163 </label>
164
165 <ul class="md-nav__list" data-md-scrollfix>
166
167
168
169
170
171
172 <li class="md-nav__item">
Eric Park35d8ee32019-08-11 01:34:35 +0800173 <a href="../.." title="Index" class="md-nav__link">
174 Index
Eric Parkc9931992019-07-29 13:10:53 +0900175 </a>
176 </li>
177
178
179
180
181
182
183
184 <li class="md-nav__item md-nav__item--nested">
185
186 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2">
187
188 <label class="md-nav__link" for="nav-2">
189 Bliss OS
190 </label>
191 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
192 <label class="md-nav__title" for="nav-2">
193 Bliss OS
194 </label>
195 <ul class="md-nav__list" data-md-scrollfix>
196
197
198
199
200
201
202
203 <li class="md-nav__item">
204 <a href="../../Bliss OS/" title="Index" class="md-nav__link">
205 Index
206 </a>
207 </li>
208
209
Eric Park608ce5a2019-08-07 21:27:46 +0800210
211
212
213
214
215 <li class="md-nav__item">
216 <a href="../../Bliss OS/extras/" title="Extras" class="md-nav__link">
217 Extras
218 </a>
219 </li>
220
221
222
223
224
225
226
227 <li class="md-nav__item">
228 <a href="../../Bliss OS/installation-guide/" title="Installation Guide" class="md-nav__link">
229 Installation Guide
230 </a>
231 </li>
232
233
234
235
236
237
238
239 <li class="md-nav__item">
240 <a href="../../Bliss OS/troubleshooting/" title="Troubleshooting" class="md-nav__link">
241 Troubleshooting
242 </a>
243 </li>
244
245
Eric Parkc9931992019-07-29 13:10:53 +0900246 </ul>
247 </nav>
248 </li>
249
250
251
252
253
254
255
256 <li class="md-nav__item md-nav__item--nested">
257
258 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
259
260 <label class="md-nav__link" for="nav-3">
261 BlissRoms
262 </label>
263 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
264 <label class="md-nav__title" for="nav-3">
265 BlissRoms
266 </label>
267 <ul class="md-nav__list" data-md-scrollfix>
268
269
270
271
272
273
274
275 <li class="md-nav__item">
276 <a href="../../BlissRoms/" title="Index" class="md-nav__link">
277 Index
278 </a>
279 </li>
280
281
282
283
284
285
286
287 <li class="md-nav__item">
Eric Park608ce5a2019-08-07 21:27:46 +0800288 <a href="../../BlissRoms/build-guide/" title="Build Guide" class="md-nav__link">
289 Build Guide
Eric Parkc9931992019-07-29 13:10:53 +0900290 </a>
291 </li>
292
293
294
295
296
297
298
299 <li class="md-nav__item">
300 <a href="../../BlissRoms/build-tips/" title="Build Tips" class="md-nav__link">
301 Build Tips
302 </a>
303 </li>
304
305
306 </ul>
307 </nav>
308 </li>
309
310
311
312
313
314
315
316
317
318 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
319
320 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4" checked>
321
322 <label class="md-nav__link" for="nav-4">
323 Common
324 </label>
325 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
326 <label class="md-nav__title" for="nav-4">
327 Common
328 </label>
329 <ul class="md-nav__list" data-md-scrollfix>
330
331
332
333
334
335
336
337 <li class="md-nav__item">
338 <a href="../" title="Index" class="md-nav__link">
339 Index
340 </a>
341 </li>
342
343
344
345
346
347
348
349
350
351 <li class="md-nav__item md-nav__item--active">
352
353 <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
354
355
356
357
358 <label class="md-nav__link md-nav__link--active" for="__toc">
359 Git Started
360 </label>
361
362 <a href="./" title="Git Started" class="md-nav__link md-nav__link--active">
363 Git Started
364 </a>
365
366
367<nav class="md-nav md-nav--secondary">
368
369
370
371
372
373 <label class="md-nav__title" for="__toc">Table of contents</label>
374 <ul class="md-nav__list" data-md-scrollfix>
375
376 <li class="md-nav__item">
377 <a href="#foreword" title="Foreword" class="md-nav__link">
378 Foreword
379 </a>
380
381 <nav class="md-nav">
382 <ul class="md-nav__list">
383
384 <li class="md-nav__item">
385 <a href="#installation" title="Installation" class="md-nav__link">
386 Installation
387 </a>
388
389</li>
390
391 <li class="md-nav__item">
392 <a href="#get-the-terminal-set-up" title="Get the terminal set up" class="md-nav__link">
393 Get the terminal set up
394 </a>
395
396</li>
397
398 <li class="md-nav__item">
399 <a href="#register-at-gerrit" title="Register at Gerrit" class="md-nav__link">
400 Register at Gerrit
401 </a>
402
403 <nav class="md-nav">
404 <ul class="md-nav__list">
405
406 <li class="md-nav__item">
407 <a href="#gerrit-shows-an-error-about-the-key" title="Gerrit shows an error about the key!" class="md-nav__link">
408 Gerrit shows an error about the key!
409 </a>
410
411</li>
412
413 </ul>
414 </nav>
415
416</li>
417
418 <li class="md-nav__item">
419 <a href="#reviewing-code" title="Reviewing Code" class="md-nav__link">
420 Reviewing Code
421 </a>
422
423 <nav class="md-nav">
424 <ul class="md-nav__list">
425
426 <li class="md-nav__item">
427 <a href="#my-output-is-blank-or-different-why" title="My output is blank (or different.) Why?" class="md-nav__link">
428 My output is blank (or different.) Why?
429 </a>
430
431</li>
432
433 <li class="md-nav__item">
434 <a href="#cherry-picking-commits-to-current-branch" title="Cherry-picking commits to current branch" class="md-nav__link">
435 Cherry-picking commits to current branch
436 </a>
437
438</li>
439
440 <li class="md-nav__item">
441 <a href="#cherry-picking-commits-to-new-branch" title="Cherry-picking commits to new branch" class="md-nav__link">
442 Cherry-picking commits to new branch
443 </a>
444
445</li>
446
447 </ul>
448 </nav>
449
450</li>
451
452 <li class="md-nav__item">
453 <a href="#submitting-code" title="Submitting code" class="md-nav__link">
454 Submitting code
455 </a>
456
457</li>
458
459 <li class="md-nav__item">
460 <a href="#picking-from-other-sources" title="Picking from other sources" class="md-nav__link">
461 Picking from other sources
462 </a>
463
464</li>
465
466 <li class="md-nav__item">
467 <a href="#conclusion" title="Conclusion" class="md-nav__link">
468 Conclusion
469 </a>
470
471</li>
472
473 </ul>
474 </nav>
475
476</li>
477
478
479
480
481
482 </ul>
483
484</nav>
485
486 </li>
487
488
Eric Park608ce5a2019-08-07 21:27:46 +0800489
490
491
492
493
494 <li class="md-nav__item">
495 <a href="../using-dippy-bird/" title="Using `dippy-bird`" class="md-nav__link">
496 Using `dippy-bird`
497 </a>
498 </li>
499
500
Eric Parkc9931992019-07-29 13:10:53 +0900501 </ul>
502 </nav>
503 </li>
504
505
506
507
508
509
510
511 <li class="md-nav__item md-nav__item--nested">
512
513 <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
514
515 <label class="md-nav__link" for="nav-5">
516 Infrastructure
517 </label>
518 <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
519 <label class="md-nav__title" for="nav-5">
520 Infrastructure
521 </label>
522 <ul class="md-nav__list" data-md-scrollfix>
523
524
525
526
527
528
529
530 <li class="md-nav__item">
531 <a href="../../infrastructure/" title="Index" class="md-nav__link">
532 Index
533 </a>
534 </li>
535
536
537 </ul>
538 </nav>
539 </li>
540
541
542 </ul>
543</nav>
544 </div>
545 </div>
546 </div>
547
548
549 <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
550 <div class="md-sidebar__scrollwrap">
551 <div class="md-sidebar__inner">
552
553<nav class="md-nav md-nav--secondary">
554
555
556
557
558
559 <label class="md-nav__title" for="__toc">Table of contents</label>
560 <ul class="md-nav__list" data-md-scrollfix>
561
562 <li class="md-nav__item">
563 <a href="#foreword" title="Foreword" class="md-nav__link">
564 Foreword
565 </a>
566
567 <nav class="md-nav">
568 <ul class="md-nav__list">
569
570 <li class="md-nav__item">
571 <a href="#installation" title="Installation" class="md-nav__link">
572 Installation
573 </a>
574
575</li>
576
577 <li class="md-nav__item">
578 <a href="#get-the-terminal-set-up" title="Get the terminal set up" class="md-nav__link">
579 Get the terminal set up
580 </a>
581
582</li>
583
584 <li class="md-nav__item">
585 <a href="#register-at-gerrit" title="Register at Gerrit" class="md-nav__link">
586 Register at Gerrit
587 </a>
588
589 <nav class="md-nav">
590 <ul class="md-nav__list">
591
592 <li class="md-nav__item">
593 <a href="#gerrit-shows-an-error-about-the-key" title="Gerrit shows an error about the key!" class="md-nav__link">
594 Gerrit shows an error about the key!
595 </a>
596
597</li>
598
599 </ul>
600 </nav>
601
602</li>
603
604 <li class="md-nav__item">
605 <a href="#reviewing-code" title="Reviewing Code" class="md-nav__link">
606 Reviewing Code
607 </a>
608
609 <nav class="md-nav">
610 <ul class="md-nav__list">
611
612 <li class="md-nav__item">
613 <a href="#my-output-is-blank-or-different-why" title="My output is blank (or different.) Why?" class="md-nav__link">
614 My output is blank (or different.) Why?
615 </a>
616
617</li>
618
619 <li class="md-nav__item">
620 <a href="#cherry-picking-commits-to-current-branch" title="Cherry-picking commits to current branch" class="md-nav__link">
621 Cherry-picking commits to current branch
622 </a>
623
624</li>
625
626 <li class="md-nav__item">
627 <a href="#cherry-picking-commits-to-new-branch" title="Cherry-picking commits to new branch" class="md-nav__link">
628 Cherry-picking commits to new branch
629 </a>
630
631</li>
632
633 </ul>
634 </nav>
635
636</li>
637
638 <li class="md-nav__item">
639 <a href="#submitting-code" title="Submitting code" class="md-nav__link">
640 Submitting code
641 </a>
642
643</li>
644
645 <li class="md-nav__item">
646 <a href="#picking-from-other-sources" title="Picking from other sources" class="md-nav__link">
647 Picking from other sources
648 </a>
649
650</li>
651
652 <li class="md-nav__item">
653 <a href="#conclusion" title="Conclusion" class="md-nav__link">
654 Conclusion
655 </a>
656
657</li>
658
659 </ul>
660 </nav>
661
662</li>
663
664
665
666
667
668 </ul>
669
670</nav>
671 </div>
672 </div>
673 </div>
674
675
676 <div class="md-content">
677 <article class="md-content__inner md-typeset">
678
679
680
681 <h1 id="git-started">Git Started</h1>
682<h2 id="foreword">Foreword</h2>
683<p>This guide helps people learn <code>git</code> commands and how to get the features you want into your favorite ROM and make your own builds. This will help new people get started and will be a great refresher for veteran <code>git</code> users and has instructions for Arch Linux users as well. The document will be ever-changing and evolving because even we will be learning new material and will be putting it in here.</p>
684<h3 id="installation">Installation</h3>
685<p>In order to use <code>git review</code> we need it installed on our local machine. For Ubuntu we use the package manager to install it.</p>
686<pre><code>sudo apt-get install git-review
687</code></pre>
688<p>Or for Arch based installs, use:</p>
689<pre><code>sudo pacman -S git-review
690</code></pre>
691<h3 id="get-the-terminal-set-up">Get the terminal set up</h3>
692<p>First, let's make sure our local <code>git</code> and Gerrit have the same email address associated.</p>
693<pre><code>cd
694cat .gitconfig
695</code></pre>
696<p>This command should show something along those lines:</p>
697<pre><code>[user]
698email = you@youremail.com
699name = Your Name
700</code></pre>
701<p>Edit any incorrect details. Your email and name is used to sign off commits, various changes, etc, so it is important that they are the same ones found on Gerrit and GitHub.</p>
702<p>Next we will create a SSH key named “gerrit” to communicate with the Gerrit server.</p>
703<pre><code>ssh-keygen -t rsa -C you@youremail.com -f ~/.ssh/gerrit
704</code></pre>
705<p>Again, note the email address must be the same here, your <code>.gitconfig</code>, and on Gerrit.</p>
706<h3 id="register-at-gerrit">Register at Gerrit</h3>
707<p>Open your favorite browser and go to <a href="http://review.blissroms.com">http://review.blissroms.com</a>. You will see a “Sign In” button on the top right - click that and register with GitHub. Please note that you will need to use the same email address that you registered with GitHub for your terminal interactions with Gerrit.</p>
708<p>Now we need to add our SSH key to Gerrit. Your name will be on the top right of the page. Click your name and you should see “Settings”. Once there click on the link “SSH Public Keys” on the left sidebar. Once it loads, click "Add Key" on the right.</p>
709<p>Let's copy the key from the terminal and paste it into the browser.</p>
710<pre><code>cat ~/.ssh/gerrit.pub
711</code></pre>
712<p>This should show something like:</p>
713<pre><code>ssh-rsa AAAABBBBBBBBBBCCCCCCCCCCCCCCCCCCDjhl8768usdfsdfuhf/BlahBlahBlah/ThIs+1s/A/fAk3+k3Y/Hdhs+PlCesTvQqfaqHTHwdzGhn2lKVt14WYvQEDKVM9JoE9e8xarNWYa0ZspB1MGn2RVJ3xRp0+Q/pA237uBCl62yTbVGtKQBZB6Q+7A54z795U+G2wCb1rAQnI5yn5q/pQ4NhB0BLml/QRmjn/S8PldEge9Hfdh4Ifdk4r9DKSiicf7IK56jklDHKkJDFkjh/3345L10sTyre3JOeZyvr5SJdyqMtmMv+uSGF28fgZ6/OEO/yBY/eYEI/XVRDaRRat8nGHGae0T4dx me@myemail.com
714</code></pre>
715<p>Starting with the line beginning with ssh-rsa and ending with the email, paste that bit into the browser and click “Add”.</p>
716<h4 id="gerrit-shows-an-error-about-the-key">Gerrit shows an error about the key!</h4>
717<p>Are you sure you used the correct key? Do not use the "private" key. The private key should be kept private as it is the key that allows you to authenticate yourself against servers like Gerrit. When you authenticate using your private key, the servers send out requests encrypted with your "public" key that only your "private" key can decrypt. This is the basis behind SSH authentication. So keep your private key safe, and try pasting the public key! Most public keys end with the characters <code>.pub</code>.</p>
718<p>Then, add the new SSH key to your local identity in terminal.</p>
719<pre><code>eval `ssh-agent`
720</code></pre>
721<p>This should print off a bunch of lines. We’re doing this to launch the ssh-agent before adding the key.</p>
722<pre><code>ssh-add ~/.ssh/gerrit
723</code></pre>
724<p>This will result in something along the lines of:</p>
725<pre><code>Identity added: /home/yourusername/.ssh/gerrit (/home/yourusername/.ssh/gerrit)
726</code></pre>
727<p>If you don’t get this, and get this instead:</p>
728<pre><code>Could not open a connection to your authentication agent.
729</code></pre>
730<p>Or this:</p>
731<pre><code>Error connecting to agent: No such file or directory.
732</code></pre>
733<p>This is because in recent versions of Ubuntu, you need to change how you launch <code>ssh-agent</code>. Run the command below, then try adding your SSH key again.</p>
734<pre><code>eval “$(ssh-agent)”
735</code></pre>
736<p>Now we should be ready to use <code>git review</code>.</p>
737<h3 id="reviewing-code">Reviewing Code</h3>
738<p>Just <code>cd</code> to your source code directory and find the package you want to look at from Gerrit. I’ll use <code>frameworks/base</code> as an example.</p>
739<pre><code># cd into source code directory
740cd ~/bliss/p9.0
741
742# Find project to work on
743cd frameworks/base
744</code></pre>
745<p>Let’s setup the remote to Gerrit:</p>
746<pre><code>git review -s
747</code></pre>
748<p>This should create a <code>gerrit</code> remote. If you added a passphrase to your SSH key you will have to enter that.</p>
749<p>However, if this command outputs something like this:</p>
750<pre><code>Could not connect to gerrit.
751Enter your gerrit username:
752</code></pre>
753<p>And after you input your username, it shows something like this:</p>
754<pre><code>Trying again with ssh://username@review.blissroms.com:29418/platform_frameworks_base.git
755&lt;traceback object at 0x7f7f95ea9e18&gt;
756We don't know where your gerrit is. Please manually create a remote named "gerrit" and try again.
757Could not connect to gerrit at ssh://username@review.blissroms.com:29418/platform_frameworks_base.git
758Traceback (most recent call last):
759 File "/usr/bin/git-review", line 10, in &lt;module&gt;
760 sys.exit(main())
761 File "/usr/lib/python2.7/dist-packages/git_review/cmd.py", line 1534, in main
762 sys.exit(e.EXIT_CODE)
763AttributeError: 'GitReviewException' object has no attribute 'EXIT_CODE'
764</code></pre>
765<p>Why does this happen? This is because the <code>ssh-agent</code> process got killed after prolonged use of the system, so you need to restart it.</p>
766<p>As a quick and dirty fix, run this again:</p>
767<pre><code>eval “$(ssh-agent)”
768</code></pre>
769<p>This should fix it. If not, then you need to go back to Chapter 1 and add your existing key. Don’t make a new key, then you’d need to add a new public key to the Bliss Gerrit.</p>
770<p>Now let’s see if there are any changes we can review.</p>
771<pre><code>git review -l
772</code></pre>
773<p>This outputs:</p>
774<pre><code>2433 new-mm6.0 SystemUI: fix double tap power launching custom lockscreen icon
7752432 new-mm6.0 SystemUI: remove extraneous debug log
776Found 2 items for review
777</code></pre>
778<h4 id="my-output-is-blank-or-different-why">My output is blank (or different.) Why?</h4>
779<p>This is because right now, there are no changes to be reviewed in <code>frameworks/base</code> (or there are different commits to be reviewed.) This is completely normal and to be expected, as we merge and submit new commits frequently. The guide will probably be out of sync with current changes by the time you are reading this.</p>
780<p>Now you have a list of commits sorted by change number with a description of what changes were made.</p>
781<p>We have a few choices of how to pick commits.</p>
782<h4 id="cherry-picking-commits-to-current-branch">Cherry-picking commits to current branch</h4>
783<pre><code>git review -x changenumber
784</code></pre>
785<p>will cherry-pick that commit to the current branch you are in. A benefit of this is the next time you <code>repo sync –force-sync</code>, it will discard the commits you picked.</p>
786<h4 id="cherry-picking-commits-to-new-branch">Cherry-picking commits to new branch</h4>
787<pre><code>git review -d changenumber
788</code></pre>
789<p>will cherry-pick to a new branch based on the submitter’s name and change ID. If you choose this route the change will be in its own branch and when you are done you can just delete that branch.</p>
790<pre><code>Switched to a new branch review/yourusername/changenumber
791</code></pre>
792<p>Now you can review the change. Follow these guidelines:</p>
793<ul>
794<li>Did the ROM build with the change incorporated?</li>
795<li>Did the added feature or fix work in the new build?</li>
796<li>Did the new commit break any other aspects of the build?</li>
797</ul>
798<p>After reviewing these guidelines, log into Gerrit via your web browser, and click on the commit you reviewed. Select the ‘Reply’ button on the top and choose your score. +1 if it works as intended, -1 if not. Be sure to leave comments on why you gave your score (such as “commit A does not show in 320 DPI”, etc)</p>
799<p>Once you're done, return to the base directory (<code>croot</code>) to follow along with the next example!</p>
800<h3 id="submitting-code">Submitting code</h3>
801<p>Go to the directory of the package or app you want to make changes to. We will use <code>frameworks/base</code> as an example.</p>
802<pre><code>cd frameworks/base
803</code></pre>
804<p>Setup the remote to Gerrit if you haven’t already:</p>
805<pre><code>git review -s
806</code></pre>
807<p>Next, make sure you are on the correct branch:</p>
808<pre><code>git branch -t p9.0 BlissRoms/p9.0
809</code></pre>
810<p>This makes sure that your local branch follows the remote branch. <code>-t</code> stands for tracking. Now we need to <code>checkout</code>, to switch to that new branch we tracked. You usually do not need to do the above command, but it is a nice check to do if something is going south.</p>
811<pre><code>git checkout p9.0
812</code></pre>
813<p>This should output:</p>
814<pre><code>Changed to new branch p9.0 tracking upstream BlissRoms/p9.0
815</code></pre>
816<p>Now make your changes, cherry-picks, etc. and commit them. If you need a guide to do that, check out <a href="#picking-from-other-sources">Picking from other sources</a>. When you’re done, come back here! Then all you have to do to send it to gerrit is:</p>
817<pre><code>git review
818</code></pre>
819<p>If you are submitting multiple commits it will ask if you really want to, just type “yes” at the prompt.</p>
820<h3 id="picking-from-other-sources">Picking from other sources</h3>
821<p>So you’ve successfully learned how to commit and send it to Bliss Gerrit. But you need to find something to commit. Thankfully, there are lots of examples you can try out. You can check other teams’ Gerrits and cherry-pick from them.</p>
822<p>For this demonstration, I’m going to use LineageOS's Gerrit. Find the commit you want, and note down the commit ID.</p>
823<p>Now, we need to add LOS’s repositories. If you’re pulling over a commit, you must make sure that we track the repository by going to Bliss’s Gerrit and checking in Projects &gt; List. If the repository is not there, it usually means we aren’t tracking it.</p>
824<pre><code>git remote add los https://github.com/LineageOS/……(your repo name)
825git remote fetch los lineage-16.0
826</code></pre>
827<p>We’ve finished adding LOS’s repositories. Now you need to grab the commit ID you copied earlier and paste it on the command underneath.</p>
828<pre><code>git cherry-pick 9ff831
829</code></pre>
830<p>Replace 9ff831 with your own commit ID. If <code>git</code> complains about duplicate revisions, paste the full SHA1 hash instead of the shorthand <code>git</code> uses.</p>
831<p>Before pushing and submitting, we need to check if our commit was successfully committed. Type the bottom command:</p>
832<pre><code>git log --oneline
833</code></pre>
834<p>After you check that your commit is there, you can push <code>q</code> to quit. Then you can follow the instructions from <a href="#submitting-code">Submitting code</a> again.</p>
835<h3 id="conclusion">Conclusion</h3>
836<p>Don’t worry if you don’t get it at once. It’s a fairly long process of submitting and reviewing at Gerrit. Read the guide again and again and you’ll start to remember commands without looking at this. I will continue with this as I learn more things, I hope this has helped someone.</p>
837<p>-- Vaughn (rwaterspf1)</p>
838<p>-- Eric Park (ideaman924)</p>
839<p>-- Jon West (electrikjesus)</p>
840
841
842
843
844
845
846
847
848
849 </article>
850 </div>
851 </div>
852 </main>
853
854
855<footer class="md-footer">
856
857 <div class="md-footer-nav">
858 <nav class="md-footer-nav__inner md-grid">
859
860 <a href="../" title="Index" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
861 <div class="md-flex__cell md-flex__cell--shrink">
862 <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
863 </div>
864 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
865 <span class="md-flex__ellipsis">
866 <span class="md-footer-nav__direction">
867 Previous
868 </span>
869 Index
870 </span>
871 </div>
872 </a>
873
874
Eric Park608ce5a2019-08-07 21:27:46 +0800875 <a href="../using-dippy-bird/" title="Using `dippy-bird`" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
Eric Parkc9931992019-07-29 13:10:53 +0900876 <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
877 <span class="md-flex__ellipsis">
878 <span class="md-footer-nav__direction">
879 Next
880 </span>
Eric Park608ce5a2019-08-07 21:27:46 +0800881 Using `dippy-bird`
Eric Parkc9931992019-07-29 13:10:53 +0900882 </span>
883 </div>
884 <div class="md-flex__cell md-flex__cell--shrink">
885 <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
886 </div>
887 </a>
888
889 </nav>
890 </div>
891
892 <div class="md-footer-meta md-typeset">
893 <div class="md-footer-meta__inner md-grid">
894 <div class="md-footer-copyright">
895
896 powered by
897 <a href="https://www.mkdocs.org">MkDocs</a>
898 and
899 <a href="https://squidfunk.github.io/mkdocs-material/">
900 Material for MkDocs</a>
901 </div>
902
903 </div>
904 </div>
905</footer>
906
907 </div>
908
909 <script src="../../assets/javascripts/application.245445c6.js"></script>
910
911 <script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
912
913
914 </body>
915</html>