Skip to content

Commit e5b5f6f

Browse files
authored
Better explain remotes in the sync process.
1 parent c1698fe commit e5b5f6f

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

CONTRIBUTING.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,18 @@ Clippy in the `rust-lang/rust` repository.
166166
For general information about `subtree`s in the Rust repository see [Rust's
167167
`CONTRIBUTING.md`][subtree].
168168

169-
Here is a TL;DR version of the sync process:
169+
Here is a TL;DR version of the sync process (all of the following commands have
170+
to be run inside the `rust` directory):
170171

171-
1. Clone the [`rust-lang/rust`] repository (all of the following commands have
172-
to be run inside the `rust` directory)
172+
1. Clone the [`rust-lang/rust`] repository
173173
2. Sync the changes to the rust-copy of Clippy to your Clippy fork:
174174
```bash
175175
# Make sure to change `your-github-name` to your github name in the following command
176176
git subtree push -P src/tools/clippy [email protected]:your-github-name/rust-clippy sync-from-rust
177177
```
178+
_Note:_ This will directly push to the remote repository. You can also push
179+
to your local copy by replacing the remote address with `/path/to/rust-clippy`
180+
directory.
178181
3. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
179182
accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
180183
~~annoy~~ ask them in the [Discord] channel.)
@@ -185,6 +188,27 @@ Here is a TL;DR version of the sync process:
185188
```
186189
5. Open a PR to [`rust-lang/rust`]
187190

191+
Also, you may want to define remotes, so you don't have to type out the remote
192+
addresses on every sync. You can do this with the following commands (these
193+
commands still have to be run inside the `rust` directory):
194+
195+
```bash
196+
# Set clippy-upstream remote for pulls
197+
$ git remote add clippy-upstream https://github.com/rust-lang/rust-clippy
198+
# Make sure to not push to the upstream repo
199+
$ git remote set-url --push clippy-upstream DISABLED
200+
# Set clippy-origin remote to your fork for pushes
201+
$ git remote add clippy-origin [email protected]:your-github-name/rust-clippy
202+
# Set a local remote
203+
$ git remote add clippy-local /path/to/rust-clippy
204+
```
205+
206+
You can then sync with the remote names from above, e.g.:
207+
208+
```bash
209+
$ git subtree push -P src/tools/clippy clippy-local sync-from-rust
210+
```
211+
188212
[subtree]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#external-dependencies-subtree
189213
[`rust-lang/rust`]: https://github.com/rust-lang/rust
190214

0 commit comments

Comments
 (0)