From de9ed3ef3740f8227cc924e845032954d1f1b1b7 Mon Sep 17 00:00:00 2001 From: Sean Barag Date: Thu, 1 Oct 2020 03:46:16 +0000 Subject: clone: allow configurable default for `-o`/`--origin` While the default remote name of "origin" can be changed at clone-time with `git clone`'s `--origin` option, it was previously not possible to specify a default value for the name of that remote. Add support for a new `clone.defaultRemoteName` config, with the newly-created remote name resolved in priority order: 1. (Highest priority) A remote name passed directly to `git clone -o` 2. A `clone.defaultRemoteName=new_name` in config `git clone -c` 3. A `clone.defaultRemoteName` value set in `/path/to/template/config`, where `--template=/path/to/template` is provided 4. A `clone.defaultRemoteName` value set in a non-template config file 5. The default value of `origin` Helped-by: Junio C Hamano Helped-by: Johannes Schindelin Helped-by: Derrick Stolee Helped-by: Andrei Rybak Signed-off-by: Sean Barag Signed-off-by: Junio C Hamano --- Documentation/config.txt | 2 ++ Documentation/config/clone.txt | 4 ++++ Documentation/git-clone.txt | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 Documentation/config/clone.txt (limited to 'Documentation') diff --git a/Documentation/config.txt b/Documentation/config.txt index 3042d80978..354874facf 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -334,6 +334,8 @@ include::config/checkout.txt[] include::config/clean.txt[] +include::config/clone.txt[] + include::config/color.txt[] include::config/column.txt[] diff --git a/Documentation/config/clone.txt b/Documentation/config/clone.txt new file mode 100644 index 0000000000..47de36a5fe --- /dev/null +++ b/Documentation/config/clone.txt @@ -0,0 +1,4 @@ +clone.defaultRemoteName:: + The name of the remote to create when cloning a repository. Defaults to + `origin`, and can be overridden by passing the `--origin` command-line + option to linkgit:git-clone[1]. diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index c898310099..f04bf6e6ba 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -183,8 +183,9 @@ objects from the source repository into a pack in the cloned repository. -o :: --origin :: - Instead of using the remote name `origin` to keep track - of the upstream repository, use ``. + Instead of using the remote name `origin` to keep track of the upstream + repository, use ``. Overrides `clone.defaultRemoteName` from the + config. -b :: --branch :: -- cgit v1.2.3