about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md30
1 files changed, 27 insertions, 3 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f7a60938374..6697ff2f40d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -166,15 +166,18 @@ Clippy in the `rust-lang/rust` repository.
 For general information about `subtree`s in the Rust repository see [Rust's
 `CONTRIBUTING.md`][subtree].
 
-Here is a TL;DR version of the sync process:
+Here is a TL;DR version of the sync process (all of the following commands have
+to be run inside the `rust` directory):
 
-1. Clone the [`rust-lang/rust`] repository (all of the following commands have
-   to be run inside the `rust` directory)
+1. Clone the [`rust-lang/rust`] repository
 2. Sync the changes to the rust-copy of Clippy to your Clippy fork:
     ```bash
     # Make sure to change `your-github-name` to your github name in the following command
     git subtree push -P src/tools/clippy git@github.com:your-github-name/rust-clippy sync-from-rust
     ```
+    _Note:_ This will directly push to the remote repository. You can also push
+    to your local copy by replacing the remote address with `/path/to/rust-clippy`
+    directory.
 3. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
    accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
    ~~annoy~~ ask them in the [Discord] channel.)
@@ -185,6 +188,27 @@ Here is a TL;DR version of the sync process:
     ```
 5. Open a PR to [`rust-lang/rust`]
 
+Also, you may want to define remotes, so you don't have to type out the remote
+addresses on every sync. You can do this with the following commands (these
+commands still have to be run inside the `rust` directory):
+
+```bash
+# Set clippy-upstream remote for pulls
+$ git remote add clippy-upstream https://github.com/rust-lang/rust-clippy
+# Make sure to not push to the upstream repo
+$ git remote set-url --push clippy-upstream DISABLED
+# Set clippy-origin remote to your fork for pushes
+$ git remote add clippy-origin git@github.com:your-github-name/rust-clippy
+# Set a local remote
+$ git remote add clippy-local /path/to/rust-clippy
+```
+
+You can then sync with the remote names from above, e.g.:
+
+```bash
+$ git subtree push -P src/tools/clippy clippy-local sync-from-rust
+```
+
 [subtree]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#external-dependencies-subtree
 [`rust-lang/rust`]: https://github.com/rust-lang/rust