Re: [PATCH v2 03/15] user-manual: Use 'remote add' to setup push URLs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 10, 2013, 21:33 UTC
- Message-ID
- <7v8v6vua50.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <44d89e81a8465d3bbf50b106a8a844c9d90ac384.1360508415.git.wking@tremily.us>
"W. Trevor King" <wking@tremily.us> writes:
Show 37 quoted lines
> From: "W. Trevor King" <wking@tremily.us> > > There is no need to use here documents to setup this configuration. > It is easier, less confusing, and more robust to use Git's > configuration tools directly. > > Signed-off-by: W. Trevor King <wking@tremily.us> > --- > Documentation/user-manual.txt | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt > index 8524c08..53f73c3 100644 > --- a/Documentation/user-manual.txt > +++ b/Documentation/user-manual.txt > @@ -1994,14 +1994,17 @@ default. See the description of the receive.denyCurrentBranch option > in linkgit:git-config[1] for details. > > As with `git fetch`, you may also set up configuration options to > -save typing; so, for example, after > +save typing; so, for example, after either > > -------------------------------------------------- > -$ cat >>.git/config <<EOF > -[remote "public-repo"] > - url = ssh://yourserver.com/~you/proj.git > -EOF > -------------------------------------------------- > +------------------------------------------------ > +$ git remote add public-repo ssh://yourserver.com/~you/proj.git > +------------------------------------------------ > + > +or, more explicitly, > + > +------------------------------------------------ > +$ git config remote.public-repo.url ssh://yourserver.com/~you/proj.git > +------------------------------------------------
Look at how "Fetching branches from other repositories" is done. It shows the use of "remote add" and then shows the result by running "cat" to show the contents.
I think that organization is much nicer than completely hiding how the result looks like behind another "git config --set" call, like the latter half of this patch does. The resulting text may read like so:
... save typing; so for example:
------------
$ git remote add public-repo yourserver.com:proj.git
------------will add this to your configuration:
------------
$ cat .git/config
...
[remote "public-repo"]
url = yourserver.com:proj.git
...
------------which lets you do the same push with just
------------
$ git push public-repo master
------------