diff --git a/docs/config.md b/docs/config.md index f97fb8313..711c64930 100644 --- a/docs/config.md +++ b/docs/config.md @@ -514,6 +514,29 @@ conflict is considered fully resolved when there are no conflict markers left. ## Git settings +### Default remotes for `jj git fetch` and `jj git push` + +By default, if a single remote exists it is used for `jj git fetch` and `jj git +push`; however if multiple remotes exist, the default remote is assumed to be +named `"origin"`, just like in Git. Sometimes this is undesirable, e.g. when you +want to fetch from a different remote than you push to, such as a GitHub fork. + +To change this behavior, you can modify the [repository +configuration](#config-files-and-toml) variable `git.fetch`, which can be a +single remote, or a list of remotes to fetch from multiple places: + +``` +jj config set --repo git.fetch "upstream" +jj config set --repo git.fetch '["origin", "upstream"]' +``` + +Similarly, you can also set the variable `git.push` to cause `jj git push` to +push to a different remote: + +``` +jj config set --repo git.push "github" +``` + ### Automatic local branch creation When `jj` imports a new remote-tracking branch from Git, it can also create a diff --git a/docs/config.toml b/docs/config.toml index f31c23289..484909214 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -1,7 +1,7 @@ # Basic template of config settings # Don't forget to change these to your own details! -user.name = "YOUR NAME" +user.name = "YOUR NAME" user.email = "YOUR_EMAIL@example.com" ui.color = "auto" # the default @@ -27,3 +27,7 @@ template-aliases.'format_timestamp(timestamp)' = 'timestamp.ago()' # see documentation in config.md. An example: # merge-tools.meld.program = "C:\\Program Files\\Meld\\meld.exe" # If not in PATH + +# Change the default push/fetch remote for `jj git push` and `jj git fetch` +# git.fetch = "upstream" +# git.push = "myfork"