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

Side by Side Diff: docs/git_cookbook.md

Issue 2551513002: Fix spelling mistakes in //docs. (Closed)
Patch Set: Undo beng->being Created 4 years 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 | « docs/emacs.md ('k') | docs/how_to_extend_layout_test_framework.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Git Cookbook 1 # Git Cookbook
2 2
3 A collection of git recipes to do common git tasks. 3 A collection of git recipes to do common git tasks.
4 4
5 See also [Git Tips](git_tips.md). 5 See also [Git Tips](git_tips.md).
6 6
7 [TOC] 7 [TOC]
8 8
9 ## Introduction 9 ## Introduction
10 10
11 This is designed to be a cookbook for common command sequences/tasks relating to 11 This is designed to be a cookbook for common command sequences/tasks relating to
12 git, git-cl, and how they work with chromium development. It might be a little 12 git, git-cl, and how they work with Chromium development. It might be a little
13 light on explanations. 13 light on explanations.
14 14
15 If you are new to git, or do not have much experience with a distributed version 15 If you are new to git, or do not have much experience with a distributed version
16 control system, you should also check out 16 control system, you should also check out
17 [The Git Community Book](http://book.git-scm.com/) for an overview of basic git 17 [The Git Community Book](http://book.git-scm.com/) for an overview of basic git
18 concepts and general git usage. Knowing what git means by branches, commits, 18 concepts and general git usage. Knowing what git means by branches, commits,
19 reverts, and resets (as opposed to what SVN means by them) will help make the 19 reverts, and resets (as opposed to what SVN means by them) will help make the
20 following much more understandable. 20 following much more understandable.
21 21
22 ## Excluding file(s) from git-cl, while preserving them for later use 22 ## Excluding file(s) from git-cl, while preserving them for later use
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 git checkout mybranch 145 git checkout mybranch
146 git reset --hard origin 146 git reset --hard origin
147 147
148 148
149 git cherry-pick abcdef # re-apply your bad change 149 git cherry-pick abcdef # re-apply your bad change
150 git show # grab the rietveld issue number out of the old commit 150 git show # grab the rietveld issue number out of the old commit
151 git cl issue 12345 # restore the rietveld issue that was cleared on commit 151 git cl issue 12345 # restore the rietveld issue that was cleared on commit
152 ``` 152 ```
153 153
154 And now you can continue hacking where you left off, and since you're reusing 154 And now you can continue hacking where you left off, and since you're reusing
155 the Reitveld issue you don't have to rewrite the commit message. (You may want 155 the Rietveld issue you don't have to rewrite the commit message. (You may want
156 to go manually reopen the issue on the Rietveld site -- `git cl status` will 156 to go manually reopen the issue on the Rietveld site -- `git cl status` will
157 give you the URL.) 157 give you the URL.)
158 158
159 ## Retrieving, or diffing against an old file revision 159 ## Retrieving, or diffing against an old file revision
160 160
161 Git works in terms of commits, not files. Thus, working with the history of a 161 Git works in terms of commits, not files. Thus, working with the history of a
162 single file requires modified version of the show and diff commands. 162 single file requires modified version of the show and diff commands.
163 163
164 ```shell 164 ```shell
165 # Find the commit you want in the file's commit log. 165 # Find the commit you want in the file's commit log.
166 git log path/to/file 166 git log path/to/file
167 # This prints out the file contents at commit 123abc. 167 # This prints out the file contents at commit 123abc.
168 git show 123abc:path/to/file 168 git show 123abc:path/to/file
169 # Diff the current version against path/to/file against the version at 169 # Diff the current version against path/to/file against the version at
170 # path/to/file 170 # path/to/file
171 git diff 123abc -- path/to/file 171 git diff 123abc -- path/to/file
172 ``` 172 ```
173 173
174 When invoking `git show` or `git diff`, the `path/to/file` is **not relative the 174 When invoking `git show` or `git diff`, the `path/to/file` is **not relative the
175 the current directory**. It must be the full path from the directory where the 175 the current directory**. It must be the full path from the directory where the
176 .git directory lives. This is different from invoking `git log` which 176 .git directory lives. This is different from invoking `git log` which
177 understands relative paths. 177 understands relative paths.
178 178
179 ## Checking out pristine branch from git-svn 179 ## Checking out pristine branch from git-svn
180 180
181 In the backend, git-svn keeps a remote tracking branch that points to the the 181 In the backend, git-svn keeps a remote tracking branch that points to the
182 commit tree representing the svn repository. The name of this branch is 182 commit tree representing the svn repository. The name of this branch is
183 configured during `git svn init`. The git-svn remote branch is often named 183 configured during `git svn init`. The git-svn remote branch is often named
184 `origin/trunk` for Chromium, and `origin/master` for WebKit. 184 `origin/trunk` for Chromium, and `origin/master` for WebKit.
185 185
186 If you want to checkout a "fresh" branch, you can base it directly off the 186 If you want to checkout a "fresh" branch, you can base it directly off the
187 remote branch for svn. 187 remote branch for svn.
188 188
189 git checkout -b fresh origin/trunk # Replace with origin/master for webkit. 189 git checkout -b fresh origin/trunk # Replace with origin/master for webkit.
190 190
191 191
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 If you have a nearby copy of a Git repo, you can quickly bootstrap your copy 266 If you have a nearby copy of a Git repo, you can quickly bootstrap your copy
267 from that one then adjust it to point it at the real upstream one. 267 from that one then adjust it to point it at the real upstream one.
268 268
269 1. Clone a nearby copy of the code you want: `git clone coworker-machine:/path/ to/repo` 269 1. Clone a nearby copy of the code you want: `git clone coworker-machine:/path/ to/repo`
270 1. Change the URL your copy fetches from to point at the real git repo: 270 1. Change the URL your copy fetches from to point at the real git repo:
271 `git set-url origin http://src.chromium.org/git/chromium.git` 271 `git set-url origin http://src.chromium.org/git/chromium.git`
272 1. Update your copy: `git fetch` 272 1. Update your copy: `git fetch`
273 1. Delete any extra branches that you picked up in the initial clone: 273 1. Delete any extra branches that you picked up in the initial clone:
274 `git prune origin` 274 `git prune origin`
OLDNEW
« no previous file with comments | « docs/emacs.md ('k') | docs/how_to_extend_layout_test_framework.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698