Skip to content

Commit 47adb8a

Browse files
wkinggitster
authored andcommitted
user-manual: mention 'git remote add' for remote branch config
I hardly ever setup remote.<name>.url using 'git config'. While it may be instructive to do so, we should also point out 'git remote add'. Signed-off-by: W. Trevor King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d1471e0 commit 47adb8a

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

Documentation/user-manual.txt

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,48 +2856,34 @@ branch.master.merge=refs/heads/master
28562856

28572857
If there are other repositories that you also use frequently, you can
28582858
create similar configuration options to save typing; for example,
2859-
after
28602859

28612860
-------------------------------------------------
2862-
$ git config remote.example.url git://example.com/proj.git
2861+
$ git remote add example git://example.com/proj.git
28632862
-------------------------------------------------
28642863

2865-
then the following two commands will do the same thing:
2864+
adds the following to `.git/config`:
28662865

28672866
-------------------------------------------------
2868-
$ git fetch git://example.com/proj.git master:refs/remotes/example/master
2869-
$ git fetch example master:refs/remotes/example/master
2867+
[remote "example"]
2868+
url = git://example.com/proj.git
2869+
fetch = +refs/heads/*:refs/remotes/example/*
28702870
-------------------------------------------------
28712871

2872-
Even better, if you add one more option:
2873-
2874-
-------------------------------------------------
2875-
$ git config remote.example.fetch master:refs/remotes/example/master
2876-
-------------------------------------------------
2872+
Also note that the above configuration can be performed by directly
2873+
editing the file `.git/config` instead of using linkgit:git-remote[1].
28772874

2878-
then the following commands will all do the same thing:
2875+
After configuring the remote, the following three commands will do the
2876+
same thing:
28792877

28802878
-------------------------------------------------
2881-
$ git fetch git://example.com/proj.git master:refs/remotes/example/master
2882-
$ git fetch example master:refs/remotes/example/master
2879+
$ git fetch git://example.com/proj.git +refs/heads/*:refs/remotes/example/*
2880+
$ git fetch example +refs/heads/*:refs/remotes/example/*
28832881
$ git fetch example
28842882
-------------------------------------------------
28852883

2886-
You can also add a "+" to force the update each time:
2887-
2888-
-------------------------------------------------
2889-
$ git config remote.example.fetch +master:refs/remotes/example/master
2890-
-------------------------------------------------
2891-
2892-
Don't do this unless you're sure you won't mind "git fetch" possibly
2893-
throwing away commits on 'example/master'.
2894-
2895-
Also note that all of the above configuration can be performed by
2896-
directly editing the file .git/config instead of using
2897-
linkgit:git-config[1].
2898-
28992884
See linkgit:git-config[1] for more details on the configuration
2900-
options mentioned above.
2885+
options mentioned above and linkgit:git-fetch[1] for more details on
2886+
the refspec syntax.
29012887

29022888

29032889
[[git-concepts]]

0 commit comments

Comments
 (0)