@@ -38,13 +38,13 @@ If you've cloned your fork, then you will be able to reference it with `origin`
3838in your local repo. It may be helpful to also set up a remote for the official
3939rust-lang/rust repo via
4040
41- ``` sh
41+ ``` console
4242git remote add upstream https://github.com/rust-lang/rust.git
4343```
4444
4545if you're using HTTPS, or
4646
47- ``` sh
47+ ``` console
4848git remote add upstream [email protected] :rust-lang/rust.git 4949```
5050
@@ -112,7 +112,7 @@ See [Rebasing](#rebasing) for more about rebasing.
112112This is not a problem from git's perspective. If you run ` git remote -v ` ,
113113it will say something like this:
114114
115- ```
115+ ``` console
116116$ git remote -v
117117origin [email protected] :jyn514/rust.git (fetch) 118118origin [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
160160These are two common errors to see when rebasing:
161- ```
161+ ``` console
162162error: cannot rebase: Your index contains uncommitted changes.
163163error: Please commit or stash them.
164164```
165- ```
165+ ``` console
166166error: cannot rebase: You have unstaged changes.
167167error: 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
174174when you finish rebasing. You may want to configure git to make this "stash" automatically, which
175175will prevent the "cannot rebase" error in nearly all cases:
176176
177- ```
177+ ``` console
178178git 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)
210210error: failed to push some refs to 'https://github.com/username/rust.git'
211211hint: 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
226226have a ` rust-lang/rust ` remote ` upstream ` , but ran ` git rebase origin/master ` instead of `git rebase
227227upstream/master`. The fix is to abort the rebase and use the correct branch instead:
228228
229- ```
229+ ``` console
230230git rebase --abort
231231git rebase -i upstream/master
232232```
@@ -243,7 +243,7 @@ When updating your local repository with `git pull`, you may notice that sometim
243243Git says you have modified some files that you have never edited. For example,
244244running ` git status ` gives you something like (note the ` new commits ` mention):
245245
246- ```
246+ ``` console
247247On branch master
248248Your 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.
278278To rebase your feature branch on top of the newest version of the master branch
279279of rust-lang/rust, checkout your branch, and then run this command:
280280
281- ```
281+ ``` console
282282git 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
300300that have been made. You can tell that this happened because you'll see
301301lines in the output that look like
302302
303- ```
303+ ```console
304304CONFLICT (content): Merge conflict in file.rs
305305```
306306
307307When you open these files, you'll see sections of the form
308308
309- ```
309+ ``` console
310310<<<<<<< HEAD
311311Original code
312312=======
@@ -346,7 +346,7 @@ will keep it up-to-date. You will also want to rebase your feature branches
346346up-to-date as well. After pulling, you can checkout the feature branches
347347and rebase them:
348348
349- ```
349+ ``` console
350350git checkout master
351351git pull upstream master --ff-only # to make certain there are no merge commits
352352git rebase master feature_branch
@@ -384,7 +384,7 @@ change the order in which they are applied, or "squash" them into each other.
384384
385385Alternatively, 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
389389git rebase -i --keep-base master # and squash all changes along the way
390390git rebase master
@@ -422,7 +422,7 @@ it shows you the differences between your old diff and your new diff.
422422Here's an example of ` git range-diff ` output (taken from [ Git's
423423docs] [ range-diff-example-docs ] ):
424424
425- ```
425+ ``` console
426426-: ------- > 1: 0ddba11 Prepare for the inevitable!
4274271: c0debee = 2: cab005e Add a helpful message at the start
4284282: 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
499499line as deleted and each line as added, forcing you to compare each line yourself. Git has an option
500500to show moved lines in a different color:
501501
502- ```
502+ ``` console
503503git 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.
515515Many large files in the repo are autogenerated. To view a diff that ignores changes to those files,
516516you can use the following syntax (e.g. Cargo.lock):
517517
518- ```
518+ ``` console
519519git log -p ':!Cargo.lock'
520520```
521521
@@ -545,7 +545,7 @@ The contents of submodules are ignored by Git: submodules are in some sense isol
545545from the rest of the repository. However, if you try to ` cd src/llvm-project ` and then
546546run ` git status ` :
547547
548- ```
548+ ``` console
549549HEAD detached at 9567f08afc943
550550nothing to commit, working tree clean
551551```
@@ -576,7 +576,7 @@ that Git can nicely and fairly conveniently handle for us.
576576
577577Sometimes you might run into (when you run ` git status ` )
578578
579- ```
579+ ``` console
580580Changes 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
587587and when you try to run ` git submodule update ` it breaks horribly with errors like
588588
589- ```
589+ ``` console
590590error: RPC failed; curl 92 HTTP/2 stream 7 was not closed cleanly: CANCEL (err 8)
591591error: 2782 bytes of body are still expected
592592fetch-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
598598If 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
608608If that doesn't work, you can try to deinit all git submodules...
609609
610- ```
610+ ``` console
611611git submodule deinit -f --all
612612```
613613
@@ -618,7 +618,7 @@ completely messed up for some reason.
618618
619619Sometimes, for some forsaken reason, you might run into
620620
621- ``` text
621+ ``` console
622622fatal: not a git repository: src/gcc/../../.git/modules/src/gcc
623623```
624624
0 commit comments