diff options
author | Junio C Hamano <junkio@cox.net> | 2007-02-01 23:30:03 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-05 15:41:59 -0800 |
commit | b6f5da1e0f4eeb59798b320f97d27f83d19f89df (patch) | |
tree | 5c87e28968f98b7faec4c8b131a9157ca428a7f5 /pkt-line.c | |
parent | blame: document --contents option (diff) | |
download | tgif-b6f5da1e0f4eeb59798b320f97d27f83d19f89df.tar.xz |
Teach git-remote add to fetch and track
This adds three options to 'git-remote add'.
* -f (or --fetch) option tells it to also run the initial "git
fetch" using the newly created remote shorthand.
* -t (or --track) option tells it not to use the default
wildcard to track all branches.
* -m (or --master) option tells it to make the
remote/$name/HEAD point at a remote tracking branch other
than master.
For example, with this I can say:
$ git remote add -f -t master -t quick-start -m master \
jbf-um git://linux-nfs.org/~bfields/git.git/
to
(1) create remote.jbf-um.url;
(2) track master and quick-start branches (and no other); the
two -t options create these two lines:
fetch = +refs/heads/master:refs/remotes/jbf-um/master
fetch = +refs/heads/quick-start:refs/remotes/jbf-um/quick-start
(3) set up remotes/jbf-um/HEAD to point at jbf-um/master so
that later I can say "git log jbf-um"
Or I could do
$ git remote add -t 'ap/*' andy /home/andy/git.git
to make Andy's topic branches kept track of under refs/remotes/andy/ap/.
Other possible improvements I considered but haven't implemented
(hint, hint) are:
* reject wildcard letters other than a trailing '*' to the -t
parameter;
* make -m optional and when the first -t parameter does not
have the trailing '*' default to that value (so the above
example does not need to say "-m master");
* if -m is not given, and -t parameter ends with '*' (i.e. the
above defaulting did not tell us where to point HEAD at), and
if we did the fetch with -f, check if 'master' was fetched
and make HEAD point at it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'pkt-line.c')
0 files changed, 0 insertions, 0 deletions