blob: 114afbe7e23340e4b3ac73960db9c33d9cf02f94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env bash
# This script rebases the current branch on the current master. It does not
# pull upstream master beforehand. If you need a fresh master, use git-refresh.
#
# Syntax: git-rebase
. llvm-common
branch=`get_branch`
echo "Rebasing $branch"
if [[ `git diff | head -1` != '' ]]; then
echo "You have uncommitted changes in your repo, bailing"
echo "Please, stash your changes and run this script again"
exit 2
fi
if [[ `git branch | grep $branch` = '' ]]; then
echo "Branch $branch doesn't exist in this repository"
exit 3
fi
if [[ "$branch" = "master" ]]; then
echo "Can't rebase master"
exit 4
fi
git rebase master
if [[ $? != 0 ]]; then
echo "Rebase failed, aborting rebase..."
safe_run git rebase --abort
exit 1
fi
|