blob: d27fea5555436644612d9ba9b1e9563611a7aac4 [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/usr/bin/env bash
2
3# This script refreshes the local repository with the contents of the
4# upstream repository. The main usage of this is to pull the
5# master branch, and sync git-svn if necessary.
6#
7# Syntax: git-refresh [all]
8
9. llvm-common
10
11# Update from origin to upstream
12safe_run git checkout master
13echo " + Fetching origin..."
14safe_run git fetch origin
15if is_git_svn; then
16 echo " + Rebasing SVN master..."
17 safe_run git svn rebase -l
18else
19 echo " + Rebasing master..."
20 safe_run git pull
21fi
22
23# Fetch all other remotes
24if [[ $1 = 'all' ]]; then
25 for remote in `git remote`; do
26 if [ "$remote" != "origin" ]; then
27 echo " + Fetching remote $remote..."
28 safe_run git fetch $remote
29 fi
30 done
31fi