gittutorial: wrap literal examples in backticks

Our coding guidelines prefer literal examples to be wrapped in `backticks` to typeset them in monospace. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Ågren committed Apr 15, 2023 at 19:29 UTC ad353d7e775aefb81322da684e005939f453c9d9
1 file changed +64 -64
Documentation/gittutorial.txt
+64 -64
@@ -49,7 +49,7 @@ $ git config --global user.email you@yourdomain.example.com
49 Importing a new project
50 -----------------------
51
52 -Assume you have a tarball project.tar.gz with your initial work. You
52 +Assume you have a tarball `project.tar.gz` with your initial work. You
53 can place it under Git revision control as follows.
54
55 ------------------------------------------------
@@ -65,10 +65,10 @@ Initialized empty Git repository in .git/
65 ------------------------------------------------
66
67 You've now initialized the working directory--you may notice a new
68 -directory created, named ".git".
68 +directory created, named `.git`.
69
70 Next, tell Git to take a snapshot of the contents of all files under the
71 -current directory (note the '.'), with 'git add':
71 +current directory (note the `.`), with `git add`:
72
73 ------------------------------------------------
74 $ git add .
@@ -76,7 +76,7 @@ $ git add .
76
77 This snapshot is now stored in a temporary staging area which Git calls
78 the "index". You can permanently store the contents of the index in the
79 -repository with 'git commit':
79 +repository with `git commit`:
80
81 ------------------------------------------------
82 $ git commit
@@ -95,15 +95,15 @@ $ git add file1 file2 file3
95 ------------------------------------------------
96
97 You are now ready to commit. You can see what is about to be committed
98 -using 'git diff' with the --cached option:
98 +using `git diff` with the `--cached` option:
99
100 ------------------------------------------------
101 $ git diff --cached
102 ------------------------------------------------
103
104 -(Without --cached, 'git diff' will show you any changes that
104 +(Without `--cached`, `git diff` will show you any changes that
105 you've made but not yet added to the index.) You can also get a brief
106 -summary of the situation with 'git status':
106 +summary of the situation with `git status`:
107
108 ------------------------------------------------
109 $ git status
@@ -127,7 +127,7 @@ $ git commit
127 This will again prompt you for a message describing the change, and then
128 record a new version of the project.
129
130 -Alternatively, instead of running 'git add' beforehand, you can use
130 +Alternatively, instead of running `git add` beforehand, you can use
131
132 ------------------------------------------------
133 $ git commit -a
@@ -150,7 +150,7 @@ Git tracks content not files
150
151 Many revision control systems provide an `add` command that tells the
152 system to start tracking changes to a new file. Git's `add` command
153 -does something simpler and more powerful: 'git add' is used both for new
153 +does something simpler and more powerful: `git add` is used both for new
154 and newly modified files, and in both cases it takes a snapshot of the
155 given files and stages that content in the index, ready for inclusion in
156 the next commit.
@@ -181,7 +181,7 @@ Managing branches
181 -----------------
182
183 A single Git repository can maintain multiple branches of
184 -development. To create a new branch named "experimental", use
184 +development. To create a new branch named `experimental`, use
185
186 ------------------------------------------------
187 $ git branch experimental
@@ -200,8 +200,8 @@ you'll get a list of all existing branches:
200 * master
201 ------------------------------------------------
202
203 -The "experimental" branch is the one you just created, and the
204 -"master" branch is a default branch that was created for you
203 +The `experimental` branch is the one you just created, and the
204 +`master` branch is a default branch that was created for you
205 automatically. The asterisk marks the branch you are currently on;
206 type
207
@@ -209,8 +209,8 @@ type
209 $ git switch experimental
210 ------------------------------------------------
211
212 -to switch to the experimental branch. Now edit a file, commit the
213 -change, and switch back to the master branch:
212 +to switch to the `experimental` branch. Now edit a file, commit the
213 +change, and switch back to the `master` branch:
214
215 ------------------------------------------------
216 (edit file)
@@ -219,9 +219,9 @@ $ git switch master
219 ------------------------------------------------
220
221 Check that the change you made is no longer visible, since it was
222 -made on the experimental branch and you're back on the master branch.
222 +made on the `experimental` branch and you're back on the `master` branch.
223
224 -You can make a different change on the master branch:
224 +You can make a different change on the `master` branch:
225
226 ------------------------------------------------
227 (edit file)
@@ -229,7 +229,7 @@ $ git commit -a
229 ------------------------------------------------
230
231 at this point the two branches have diverged, with different changes
232 -made in each. To merge the changes made in experimental into master, run
232 +made in each. To merge the changes made in `experimental` into `master`, run
233
234 ------------------------------------------------
235 $ git merge experimental
@@ -257,16 +257,16 @@ $ gitk
257
258 will show a nice graphical representation of the resulting history.
259
260 -At this point you could delete the experimental branch with
260 +At this point you could delete the `experimental` branch with
261
262 ------------------------------------------------
263 $ git branch -d experimental
264 ------------------------------------------------
265
266 -This command ensures that the changes in the experimental branch are
266 +This command ensures that the changes in the `experimental` branch are
267 already in the current branch.
268
269 -If you develop on a branch crazy-idea, then regret it, you can always
269 +If you develop on a branch `crazy-idea`, then regret it, you can always
270 delete the branch with
271
272 -------------------------------------
@@ -280,7 +280,7 @@ Using Git for collaboration
280 ---------------------------
281
282 Suppose that Alice has started a new project with a Git repository in
283 -/home/alice/project, and that Bob, who has a home directory on the
283 +`/home/alice/project`, and that Bob, who has a home directory on the
284 same machine, wants to contribute.
285
286 Bob begins with:
@@ -289,7 +289,7 @@ Bob begins with:
289 bob$ git clone /home/alice/project myrepo
290 ------------------------------------------------
291
292 -This creates a new directory "myrepo" containing a clone of Alice's
292 +This creates a new directory `myrepo` containing a clone of Alice's
293 repository. The clone is on an equal footing with the original
294 project, possessing its own copy of the original project's history.
295
@@ -302,31 +302,31 @@ bob$ git commit -a
302 ------------------------------------------------
303
304 When he's ready, he tells Alice to pull changes from the repository
305 -at /home/bob/myrepo. She does this with:
305 +at `/home/bob/myrepo`. She does this with:
306
307 ------------------------------------------------
308 alice$ cd /home/alice/project
309 alice$ git pull /home/bob/myrepo master
310 ------------------------------------------------
311
312 -This merges the changes from Bob's "master" branch into Alice's
312 +This merges the changes from Bob's `master` branch into Alice's
313 current branch. If Alice has made her own changes in the meantime,
314 then she may need to manually fix any conflicts.
315
316 -The "pull" command thus performs two operations: it fetches changes
316 +The `pull` command thus performs two operations: it fetches changes
317 from a remote branch, then merges them into the current branch.
318
319 Note that in general, Alice would want her local changes committed before
320 -initiating this "pull". If Bob's work conflicts with what Alice did since
320 +initiating this `pull`. If Bob's work conflicts with what Alice did since
321 their histories forked, Alice will use her working tree and the index to
322 resolve conflicts, and existing local changes will interfere with the
323 conflict resolution process (Git will still perform the fetch but will
324 refuse to merge -- Alice will have to get rid of her local changes in
325 some way and pull again when this happens).
326
327 -Alice can peek at what Bob did without merging first, using the "fetch"
327 +Alice can peek at what Bob did without merging first, using the `fetch`
328 command; this allows Alice to inspect what Bob did, using a special
329 -symbol "FETCH_HEAD", in order to determine if he has anything worth
329 +symbol `FETCH_HEAD`, in order to determine if he has anything worth
330 pulling, like this:
331
332 ------------------------------------------------
@@ -335,10 +335,10 @@ alice$ git log -p HEAD..FETCH_HEAD
335 ------------------------------------------------
336
337 This operation is safe even if Alice has uncommitted local changes.
338 -The range notation "HEAD..FETCH_HEAD" means "show everything that is reachable
339 -from the FETCH_HEAD but exclude anything that is reachable from HEAD".
340 -Alice already knows everything that leads to her current state (HEAD),
341 -and reviews what Bob has in his state (FETCH_HEAD) that she has not
338 +The range notation `HEAD..FETCH_HEAD` means "show everything that is reachable
339 +from the `FETCH_HEAD` but exclude anything that is reachable from `HEAD`".
340 +Alice already knows everything that leads to her current state (`HEAD`),
341 +and reviews what Bob has in his state (`FETCH_HEAD`) that she has not
342 seen with this command.
343
344 If Alice wants to visualize what Bob did since their histories forked
@@ -348,7 +348,7 @@ she can issue the following command:
348 $ gitk HEAD..FETCH_HEAD
349 ------------------------------------------------
350
351 -This uses the same two-dot range notation we saw earlier with 'git log'.
351 +This uses the same two-dot range notation we saw earlier with `git log`.
352
353 Alice may want to view what both of them did since they forked.
354 She can use three-dot form instead of the two-dot form:
@@ -360,13 +360,13 @@ $ gitk HEAD...FETCH_HEAD
360 This means "show everything that is reachable from either one, but
361 exclude anything that is reachable from both of them".
362
363 -Please note that these range notation can be used with both gitk
364 -and "git log".
363 +Please note that these range notation can be used with both `gitk`
364 +and `git log`.
365
366 After inspecting what Bob did, if there is nothing urgent, Alice may
367 decide to continue working without pulling from Bob. If Bob's history
368 does have something Alice would immediately need, Alice may choose to
369 -stash her work-in-progress first, do a "pull", and then finally unstash
369 +stash her work-in-progress first, do a `pull`, and then finally unstash
370 her work-in-progress on top of the resulting history.
371
372 When you are working in a small closely knit group, it is not
@@ -378,8 +378,8 @@ it easier:
378 alice$ git remote add bob /home/bob/myrepo
379 ------------------------------------------------
380
381 -With this, Alice can perform the first part of the "pull" operation
382 -alone using the 'git fetch' command without merging them with her own
381 +With this, Alice can perform the first part of the `pull` operation
382 +alone using the `git fetch` command without merging them with her own
383 branch, using:
384
385 -------------------------------------
@@ -387,7 +387,7 @@ alice$ git fetch bob
387 -------------------------------------
388
389 Unlike the longhand form, when Alice fetches from Bob using a
390 -remote repository shorthand set up with 'git remote', what was
390 +remote repository shorthand set up with `git remote`, what was
391 fetched is stored in a remote-tracking branch, in this case
392 `bob/master`. So after this:
393
@@ -396,10 +396,10 @@ alice$ git log -p master..bob/master
396 -------------------------------------
397
398 shows a list of all the changes that Bob made since he branched from
399 -Alice's master branch.
399 +Alice's `master` branch.
400
401 After examining those changes, Alice
402 -could merge the changes into her master branch:
402 +could merge the changes into her `master` branch:
403
404 -------------------------------------
405 alice$ git merge bob/master
@@ -431,12 +431,12 @@ bob$ git config --get remote.origin.url
431 /home/alice/project
432 -------------------------------------
433
434 -(The complete configuration created by 'git clone' is visible using
434 +(The complete configuration created by `git clone` is visible using
435 `git config -l`, and the linkgit:git-config[1] man page
436 explains the meaning of each option.)
437
438 -Git also keeps a pristine copy of Alice's master branch under the
439 -name "origin/master":
438 +Git also keeps a pristine copy of Alice's `master` branch under the
439 +name `origin/master`:
440
441 -------------------------------------
442 bob$ git branch -r
@@ -461,8 +461,8 @@ Exploring history
461 -----------------
462
463 Git history is represented as a series of interrelated commits. We
464 -have already seen that the 'git log' command can list those commits.
465 -Note that first line of each git log entry also gives a name for the
464 +have already seen that the `git log` command can list those commits.
465 +Note that first line of each `git log` entry also gives a name for the
466 commit:
467
468 -------------------------------------
@@ -474,7 +474,7 @@ Date: Tue May 16 17:18:22 2006 -0700
474 merge-base: Clarify the comments on post processing.
475 -------------------------------------
476
477 -We can give this name to 'git show' to see the details about this
477 +We can give this name to `git show` to see the details about this
478 commit.
479
480 -------------------------------------
@@ -513,7 +513,7 @@ You can also give commits names of your own; after running
513 $ git tag v2.5 1b2e1d63ff
514 -------------------------------------
515
516 -you can refer to 1b2e1d63ff by the name "v2.5". If you intend to
516 +you can refer to `1b2e1d63ff` by the name `v2.5`. If you intend to
517 share this name with other people (for example, to identify a release
518 version), you should create a "tag" object, and perhaps sign it; see
519 linkgit:git-tag[1] for details.
@@ -532,22 +532,22 @@ $ git reset --hard HEAD^ # reset your current branch and working
532 Be careful with that last command: in addition to losing any changes
533 in the working directory, it will also remove all later commits from
534 this branch. If this branch is the only branch containing those
535 -commits, they will be lost. Also, don't use 'git reset' on a
535 +commits, they will be lost. Also, don't use `git reset` on a
536 publicly-visible branch that other developers pull from, as it will
537 force needless merges on other developers to clean up the history.
538 -If you need to undo changes that you have pushed, use 'git revert'
538 +If you need to undo changes that you have pushed, use `git revert`
539 instead.
540
541 -The 'git grep' command can search for strings in any version of your
541 +The `git grep` command can search for strings in any version of your
542 project, so
543
544 -------------------------------------
545 $ git grep "hello" v2.5
546 -------------------------------------
547
548 -searches for all occurrences of "hello" in v2.5.
548 +searches for all occurrences of "hello" in `v2.5`.
549
550 -If you leave out the commit name, 'git grep' will search any of the
550 +If you leave out the commit name, `git grep` will search any of the
551 files it manages in your current directory. So
552
553 -------------------------------------
@@ -557,7 +557,7 @@ $ git grep "hello"
557 is a quick way to search just the files that are tracked by Git.
558
559 Many Git commands also take sets of commits, which can be specified
560 -in a number of ways. Here are some examples with 'git log':
560 +in a number of ways. Here are some examples with `git log`:
561
562 -------------------------------------
563 $ git log v2.5..v2.6 # commits between v2.5 and v2.6
@@ -567,16 +567,16 @@ $ git log v2.5.. Makefile # commits since v2.5 which modify
567 # Makefile
568 -------------------------------------
569
570 -You can also give 'git log' a "range" of commits where the first is not
570 +You can also give `git log` a "range" of commits where the first is not
571 necessarily an ancestor of the second; for example, if the tips of
572 -the branches "stable" and "master" diverged from a common
572 +the branches `stable` and `master` diverged from a common
573 commit some time ago, then
574
575 -------------------------------------
576 $ git log stable..master
577 -------------------------------------
578
579 -will list commits made in the master branch but not in the
579 +will list commits made in the `master` branch but not in the
580 stable branch, while
581
582 -------------------------------------
@@ -584,15 +584,15 @@ $ git log master..stable
584 -------------------------------------
585
586 will show the list of commits made on the stable branch but not
587 -the master branch.
587 +the `master` branch.
588
589 -The 'git log' command has a weakness: it must present commits in a
589 +The `git log` command has a weakness: it must present commits in a
590 list. When the history has lines of development that diverged and
591 -then merged back together, the order in which 'git log' presents
591 +then merged back together, the order in which `git log` presents
592 those commits is meaningless.
593
594 Most projects with multiple contributors (such as the Linux kernel,
595 -or Git itself) have frequent merges, and 'gitk' does a better job of
595 +or Git itself) have frequent merges, and `gitk` does a better job of
596 visualizing their history. For example,
597
598 -------------------------------------
@@ -600,7 +600,7 @@ $ gitk --since="2 weeks ago" drivers/
600 -------------------------------------
601
602 allows you to browse any commits from the last 2 weeks of commits
603 -that modified files under the "drivers" directory. (Note: you can
603 +that modified files under the `drivers` directory. (Note: you can
604 adjust gitk's fonts by holding down the control key while pressing
605 "-" or "+".)
606
@@ -612,7 +612,7 @@ of the file:
612 $ git diff v2.5:Makefile HEAD:Makefile.in
613 -------------------------------------
614
615 -You can also use 'git show' to see any such file:
615 +You can also use `git show` to see any such file:
616
617 -------------------------------------
618 $ git show v2.5:Makefile
@@ -648,7 +648,7 @@ digressions that may be interesting at this point are:
648
649 * linkgit:git-bisect[1]: When there is a regression in your
650 project, one way to track down the bug is by searching through
651 - the history to find the exact commit that's to blame. Git bisect
651 + the history to find the exact commit that's to blame. `git bisect`
652 can help you perform a binary search for that commit. It is
653 smart enough to perform a close-to-optimal search even in the
654 case of complex non-linear history with lots of merged branches.