From 1e592d65b50dbec87fde9f4ef1b7fd8d90bf7b8c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 18 Feb 2007 23:00:00 -0500 Subject: Teach git-remote to update existing remotes by fetching from them This allows users to use the command "git remote update" to update all remotes that are being tracked in the repository. Signed-off-by: "Theodore Ts'o" Signed-off-by: Junio C Hamano --- git-remote.perl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'git-remote.perl') diff --git a/git-remote.perl b/git-remote.perl index c56c5a84a4..6e473ecfd0 100755 --- a/git-remote.perl +++ b/git-remote.perl @@ -303,6 +303,18 @@ sub add_usage { show_remote($ARGV[$i], $ls_remote); } } +elsif ($ARGV[0] eq 'update') { + my $conf = $git->config("remote.fetch"); + if (defined($conf)) { + @remotes = split(' ', $conf); + } else { + @remotes = sort keys %$remote; + } + for (@remotes) { + print "Fetching $_\n"; + $git->command('fetch', "$_"); + } +} elsif ($ARGV[0] eq 'prune') { my $ls_remote = 1; my $i; @@ -360,5 +372,6 @@ sub add_usage { print STDERR " git remote add \n"; print STDERR " git remote show \n"; print STDERR " git remote prune \n"; + print STDERR " git remote update\n"; exit(1); } -- cgit 1.2.3-korg