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 <wking@tremily.us> Signed-off-by: Junio C Hamano <gitster@pobox.com>
W. Trevor King committed
Feb 17, 2013 at 19:15 UTC
47adb8ac7c550bc89e7eae743dcc8940c2549edf
1 file changed
+13
-27
Documentation/user-manual.txt
+13
-27
@@ -2856,48 +2856,34 @@ branch.master.merge=refs/heads/master
2856
2857
If there are other repositories that you also use frequently, you can
2858
create similar configuration options to save typing; for example,
2859
-after
2859
2860
-------------------------------------------------
2862
-$ git config remote.example.url git://example.com/proj.git
2861
+$ git remote add example git://example.com/proj.git
2862
-------------------------------------------------
2863
2865
-then the following two commands will do the same thing:
2864
+adds the following to `.git/config`:
2865
2866
-------------------------------------------------
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/*
2870
-------------------------------------------------
2871
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].
2874
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:
2877
2878
-------------------------------------------------
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/*
2881
$ git fetch example
2882
-------------------------------------------------
2883
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
-
2884
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.
2887
2888
2889
[[git-concepts]]