Skip to content

Commit 0220b0b

Browse files
committed
use correct code block markers
1 parent b9fbcd1 commit 0220b0b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/git.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ If you've cloned your fork, then you will be able to reference it with `origin`
3838
in your local repo. It may be helpful to also set up a remote for the official
3939
rust-lang/rust repo via
4040

41-
```sh
41+
```console
4242
git remote add upstream https://github.com/rust-lang/rust.git
4343
```
4444

4545
if you're using HTTPS, or
4646

47-
```sh
47+
```console
4848
git remote add upstream [email protected]:rust-lang/rust.git
4949
```
5050

@@ -112,7 +112,7 @@ See [Rebasing](#rebasing) for more about rebasing.
112112
This is not a problem from git's perspective. If you run `git remote -v`,
113113
it will say something like this:
114114

115-
```
115+
```console
116116
$ git remote -v
117117
origin [email protected]:jyn514/rust.git (fetch)
118118
origin [email protected]:jyn514/rust.git (push)
@@ -158,11 +158,11 @@ To fix it, do the following things:
158158
### I see "error: cannot rebase" when I try to rebase
159159

160160
These are two common errors to see when rebasing:
161-
```
161+
```console
162162
error: cannot rebase: Your index contains uncommitted changes.
163163
error: Please commit or stash them.
164164
```
165-
```
165+
```console
166166
error: cannot rebase: You have unstaged changes.
167167
error: Please commit or stash them.
168168
```
@@ -174,7 +174,7 @@ commit your changes, or make a temporary commit called a "stash" to have them st
174174
when you finish rebasing. You may want to configure git to make this "stash" automatically, which
175175
will prevent the "cannot rebase" error in nearly all cases:
176176

177-
```
177+
```console
178178
git config --global rebase.autostash true
179179
```
180180

@@ -205,7 +205,7 @@ git reset --hard master
205205

206206
`git push` will not work properly and say something like this:
207207

208-
```
208+
```console
209209
! [rejected] issue-xxxxx -> issue-xxxxx (non-fast-forward)
210210
error: failed to push some refs to 'https://github.com/username/rust.git'
211211
hint: Updates were rejected because the tip of your current branch is behind
@@ -226,7 +226,7 @@ didn't write, it likely means you're trying to rebase over the wrong branch. For
226226
have a `rust-lang/rust` remote `upstream`, but ran `git rebase origin/master` instead of `git rebase
227227
upstream/master`. The fix is to abort the rebase and use the correct branch instead:
228228

229-
```
229+
```console
230230
git rebase --abort
231231
git rebase -i upstream/master
232232
```
@@ -243,7 +243,7 @@ When updating your local repository with `git pull`, you may notice that sometim
243243
Git says you have modified some files that you have never edited. For example,
244244
running `git status` gives you something like (note the `new commits` mention):
245245

246-
```
246+
```console
247247
On branch master
248248
Your branch is up to date with 'origin/master'.
249249

@@ -278,12 +278,12 @@ merged. To do that, you need to rebase your work on top of rust-lang/rust.
278278
To rebase your feature branch on top of the newest version of the master branch
279279
of rust-lang/rust, checkout your branch, and then run this command:
280280

281-
```
281+
```console
282282
git pull --rebase https://github.com/rust-lang/rust.git master
283283
```
284284

285285
> If you are met with the following error:
286-
> ```
286+
> ```console
287287
> error: cannot pull with rebase: Your index contains uncommitted changes.
288288
> error: please commit or stash them.
289289
> ```
@@ -300,13 +300,13 @@ reapply the changes fails because your changes conflicted with other changes
300300
that have been made. You can tell that this happened because you'll see
301301
lines in the output that look like
302302
303-
```
303+
```console
304304
CONFLICT (content): Merge conflict in file.rs
305305
```
306306
307307
When you open these files, you'll see sections of the form
308308

309-
```
309+
```console
310310
<<<<<<< HEAD
311311
Original code
312312
=======
@@ -346,7 +346,7 @@ will keep it up-to-date. You will also want to rebase your feature branches
346346
up-to-date as well. After pulling, you can checkout the feature branches
347347
and rebase them:
348348

349-
```
349+
```console
350350
git checkout master
351351
git pull upstream master --ff-only # to make certain there are no merge commits
352352
git rebase master feature_branch
@@ -384,7 +384,7 @@ change the order in which they are applied, or "squash" them into each other.
384384

385385
Alternatively, you can sacrifice the commit history like this:
386386

387-
```
387+
```console
388388
# squash all the changes into one commit so you only have to worry about conflicts once
389389
git rebase -i --keep-base master # and squash all changes along the way
390390
git rebase master
@@ -422,7 +422,7 @@ it shows you the differences between your old diff and your new diff.
422422
Here's an example of `git range-diff` output (taken from [Git's
423423
docs][range-diff-example-docs]):
424424

425-
```
425+
```console
426426
-: ------- > 1: 0ddba11 Prepare for the inevitable!
427427
1: c0debee = 2: cab005e Add a helpful message at the start
428428
2: f00dbal ! 3: decafe1 Describe a bug
@@ -499,7 +499,7 @@ Git and Github's default diff view for large moves *within* a file is quite poor
499499
line as deleted and each line as added, forcing you to compare each line yourself. Git has an option
500500
to show moved lines in a different color:
501501

502-
```
502+
```console
503503
git log -p --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change
504504
```
505505

@@ -515,7 +515,7 @@ that was force-pushed to make sure there are no unexpected changes.
515515
Many large files in the repo are autogenerated. To view a diff that ignores changes to those files,
516516
you can use the following syntax (e.g. Cargo.lock):
517517

518-
```
518+
```console
519519
git log -p ':!Cargo.lock'
520520
```
521521

@@ -545,7 +545,7 @@ The contents of submodules are ignored by Git: submodules are in some sense isol
545545
from the rest of the repository. However, if you try to `cd src/llvm-project` and then
546546
run `git status`:
547547

548-
```
548+
```console
549549
HEAD detached at 9567f08afc943
550550
nothing to commit, working tree clean
551551
```
@@ -576,7 +576,7 @@ that Git can nicely and fairly conveniently handle for us.
576576

577577
Sometimes you might run into (when you run `git status`)
578578

579-
```
579+
```console
580580
Changes not staged for commit:
581581
(use "git add <file>..." to update what will be committed)
582582
(use "git restore <file>..." to discard changes in working directory)
@@ -586,7 +586,7 @@ Changes not staged for commit:
586586

587587
and when you try to run `git submodule update` it breaks horribly with errors like
588588

589-
```
589+
```console
590590
error: RPC failed; curl 92 HTTP/2 stream 7 was not closed cleanly: CANCEL (err 8)
591591
error: 2782 bytes of body are still expected
592592
fetch-pack: unexpected disconnect while reading sideband packet
@@ -597,7 +597,7 @@ fatal: Fetched in submodule path 'src/llvm-project', but it did not contain 5a51
597597

598598
If you see `(new commits, modified content)` you can run
599599

600-
```bash
600+
```console
601601
$ git submodule foreach git reset --hard
602602
```
603603

@@ -607,7 +607,7 @@ and then try `git submodule update` again.
607607

608608
If that doesn't work, you can try to deinit all git submodules...
609609

610-
```
610+
```console
611611
git submodule deinit -f --all
612612
```
613613

@@ -618,7 +618,7 @@ completely messed up for some reason.
618618

619619
Sometimes, for some forsaken reason, you might run into
620620

621-
```text
621+
```console
622622
fatal: not a git repository: src/gcc/../../.git/modules/src/gcc
623623
```
624624

0 commit comments

Comments
 (0)