Commit graph

6 commits

Author SHA1 Message Date
Junio C Hamano b6f5da1e0f 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>
2007-02-05 15:41:59 -08:00
Shawn O. Pearce 859607dfe0 Teach 'git remote' how to cleanup stale tracking branches.
Since it can be annoying to manually cleanup 40 tracking branches
which were removed by the remote system, 'git remote prune <n>'
can now be used to delete any tracking branches under <n> which
are no longer available on the remote system.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-01 22:06:36 -08:00
Shawn O. Pearce 7a8c9ec1a9 Pull out remote listing functions in git-remote.
I want to reuse the stale branch detection to implement a new
'git remote prune' subcommand.  Easiest way to do that is to use
the same logic that 'git remote show' uses to determine the stale
tracking branches, then delete those.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-01 22:03:42 -08:00
Tom Prince e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Quy Tonthat c03f77573a git-remote: no longer silent on unknown commands.
Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-13 10:03:44 -08:00
Junio C Hamano e194cd1e0e git-remote
It might be handy to have a single command that helps you manage
your configuration that relates to downloading from remote
repositories.  This currently does only about 20% of what I want
it to do.

	$ git remote

shows the list of 'remotes' you have defined somewhere, and

	$ git remote origin

shows the details about the named remote (in this case
"origin").  How the branches are tracked, if you have a
tracking branch that is stale, etc.

	$ git add another git://git.kernel.org/pub/...

defines the default remote.another.url and remote.another.fetch
entries just like a clone does; you can say "git fetch another"
afterwards.

For it to be useful, I think it should be enhanced to:

 - check overlaps of tracking branches and warn;

 - offer to remove stale tracking branches in one go;

 - offer ways to remove or rename remote;

 - offer ways to update an existing remote, perhaps have an
   interactive mode;

Other enhancements might be also possible, but I do not think of
anything that is absolutely necessary other than the above right
now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-04 23:22:39 -08:00