]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-remote.perl
Teach git-remote to update existing remotes by fetching from them
[thirdparty/git.git] / git-remote.perl
index c56c5a84a4ac67648efd3c5ccf690e9cb21dd54f..6e473ecfd06b56524acca7d69dc0e8eff5b9c820 100755 (executable)
@@ -303,6 +303,18 @@ elsif ($ARGV[0] eq 'show') {
                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 @@ else {
        print STDERR "       git remote add <name> <url>\n";
        print STDERR "       git remote show <name>\n";
        print STDERR "       git remote prune <name>\n";
+       print STDERR "       git remote update\n";
        exit(1);
 }