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

Side by Side Diff: README.git-cl.md

Issue 2296393003: Proofread README.git-cl.md. (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # git-cl 1 # git-cl
2 2
3 The git-cl README describes the git-cl command set. This document describes how 3 The git-cl README describes the git-cl command set. This document describes how
4 code review and git work together in general, intended for people familiar with 4 code review and git work together in general, intended for people familiar with
5 git but unfamiliar with the code review process supported by Rietveld and 5 git but unfamiliar with the code review process supported by Rietveld and
6 Gerrit. 6 Gerrit.
7 7
8 8
9 ## Reitveld concepts and terms 9 ## Rietveld concepts and terms
10 10
11 A Rietveld review is for discussion of a single change or patch. You upload a 11 A Rietveld review is for discussion of a single change or patch. You upload a
12 proposed change, the reviewer comments on your change, and then you can upload a 12 proposed change, the reviewer comments on your change, and then you can upload a
13 revised version of your change. Rietveld stores the history of uploaded patches 13 revised version of your change. Rietveld stores the history of uploaded patches
14 as well as the comments, and can compute diffs in between these patches. The 14 as well as the comments, and can compute diffs in between these patches. The
15 history of a patch is very much like a small branch in git, but since Rietveld 15 history of a patch is very much like a small branch in git, but since Rietveld
16 is VCS-agnostic the concepts don't map perfectly. The identifier for a single 16 is VCS-agnostic, the concepts don't map perfectly. The identifier for a single
17 review+patches+comments in Rietveld is called an `issue`. 17 review thread including patches and comments in Rietveld is called an **issue**.
18 18
19 Rietveld provides a basic uploader that understands git. This program is used by 19 Rietveld provides a basic uploader that understands git. This program is used by
20 git-cl, and is included in the git-cl repo as upload.py. 20 git-cl, and is included in the git-cl repo as upload.py.
21 21
22 22
23 ## Basic interaction with git 23 ## Basic interaction with git
24 24
25 The fundamental problem you encounter when you try to mix git and code review is 25 The fundamental problem you encounter when you try to mix git and code review is
26 that with git it's nice to commit code locally, while during a code review 26 that with git it's nice to commit code locally, while during a code review
27 you're often requested to change something about your code. There are a few 27 you're often requested to change something about your code. There are a few
28 different ways you can handle this workflow with git: 28 different ways you can handle this workflow with git:
29 29
30 1. Rewriting a single commit. Say the origin commit is O, and you commit your 30 1. Rewriting a single commit. Say the origin commit is O, and you commit your
31 initial work in a commit A, making your history like O--A. After review 31 initial work in a commit A, making your history like O--A. After review
32 comments, you commit --amend, effectively erasing A and making a new commit 32 comments, you `git commit --amend`, effectively erasing A and making a new
33 A', so history is now O--A'. (Equivalently, you can use git reset --soft or 33 commit A', so history is now O--A'. (Equivalently, you can use
34 git rebase -i.) 34 `git reset --soft` or `git rebase -i`.)
35 2. Writing follow-up commits. Initial work is again in A, and after review 35 2. Writing follow-up commits. Initial work is again in A, and after review
36 comments, you write a new commit B so your history looks like O--A--B. When 36 comments, you write a new commit B so your history looks like O--A--B. When
37 you upload the revised patch, you upload the diff of O..B, not A..B; you 37 you upload the revised patch, you upload the diff of O..B, not A..B; you
38 always upload the full diff of what you're proposing to change. 38 always upload the full diff of what you're proposing to change.
39 39
40 The Rietveld patch uploader just takes arguments to `git diff`, so either of the 40 The Rietveld patch uploader just takes arguments to `git diff`, so either of the
41 above workflows work fine. If all you want to do is upload a patch, you can use 41 above workflows work fine. If all you want to do is upload a patch, you can use
42 the upload.py provided by Rietveld with arguments like this: 42 the upload.py provided by Rietveld with arguments like this:
43 43
44 upload.py --server server.com <args to "git diff"> 44 upload.py --server server.com <args to "git diff">
(...skipping 26 matching lines...) Expand all
71 71
72 The above is all you need to know for working on a single patch. 72 The above is all you need to know for working on a single patch.
73 73
74 Things get much more complicated when you have a series of commits that you want 74 Things get much more complicated when you have a series of commits that you want
75 to get reviewed. Say your history looks like O--A--B--C. If you want to upload 75 to get reviewed. Say your history looks like O--A--B--C. If you want to upload
76 that as a single review, everything works just as above. 76 that as a single review, everything works just as above.
77 77
78 But what if you upload each of A, B, and C as separate reviews? What if you 78 But what if you upload each of A, B, and C as separate reviews? What if you
79 then need to change A? 79 then need to change A?
80 80
81 1. One option is rewriting history: write a new commit A', then use git rebase 81 1. One option is rewriting history: write a new commit A', then use
82 -i to insert that diff in as O--A--A'--B--C as well as squash it. This is 82 `git rebase -i` to insert that diff in as O--A--A'--B--C as well as squash
83 sometimes not possible if B and C have touched some lines affected by A'. 83 it. This is sometimes not possible if B and C have touched some lines
84 affected by A'.
84 2. Another option, and the one espoused by software like topgit, is for you to 85 2. Another option, and the one espoused by software like topgit, is for you to
85 have separate branches for A, B, and C, and after writing A' you merge it 86 have separate branches for A, B, and C, and after writing A' you merge it
86 into each of those branches. (topgit automates this merging process.) This 87 into each of those branches. (topgit automates this merging process.) This
87 is also what is recommended by git-cl, which likes having different branch 88 is also what is recommended by git-cl, which likes having different branch
88 identifiers to hang the issue number off of. Your history ends up looking 89 identifiers to hang the issue number off of. Your history ends up looking
89 like: 90 like:
90 91
91 O---A---B---C 92 O---A---B---C
92 \ \ \ 93 \ \ \
93 A'--B'--C' 94 A'--B'--C'
94 95
95 Which is ugly, but it accurately tracks the real history of your work, can be 96 Which is ugly, but it accurately tracks the real history of your work, can be
96 thrown away at the end by committing A+A' as a single `squash` commit. 97 thrown away at the end by committing A+A' as a single `squash` commit.
97 98
98 In practice, this comes up pretty rarely. Suggestions for better workflows are 99 In practice, this comes up pretty rarely. Suggestions for better workflows are
99 welcome. 100 welcome.
100 101
101 ## Bash auto complition 102 ## Bash auto completion
102 103
103 1. Ensure that your base git commands are autocompleted 104 1. Ensure that your base git commands are autocompleted
104 [doc](https://git-scm.com/book/en/v1/Git-Basics-Tips-and-Tricks). 105 [doc](https://git-scm.com/book/en/v1/Git-Basics-Tips-and-Tricks).
105 2. Add this to your .bashrc: 106 2. Add this to your .bashrc:
106 107
107 # The next line enables bash completion for git cl. 108 # The next line enables bash completion for git cl.
108 if [ -f "$HOME/bin/depot_tools/git_cl_completion.sh" ]; then 109 if [ -f "$HOME/bin/depot_tools/git_cl_completion.sh" ]; then
109 . "$HOME/bin/depot_tools/git_cl_completion.sh" 110 . "$HOME/bin/depot_tools/git_cl_completion.sh"
110 fi 111 fi
111 112
112 3. Profit. 113 3. Profit.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698