Skip to content
Snippets Groups Projects
Verified Commit e1a5a2cc authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Improve fetch git branch logic

parent a27a6415
No related branches found
No related tags found
No related merge requests found
...@@ -119,14 +119,17 @@ function op { ...@@ -119,14 +119,17 @@ function op {
git remote add upstream "$GIT_UPSTREAM" git remote add upstream "$GIT_UPSTREAM"
git fetch upstream git fetch upstream
fi fi
ORIGIN_BRANCH="$(git branch --remotes | grep '^ origin/HEAD -> ' | cut -d ' ' -f 5-)"
if [ -n "$BRANCH" ] if [ -n "$BRANCH" ]
then then
git checkout "$BRANCH" ORIGIN_BRANCH="origin/$BRANCH"
else fi
#TODO: Find correct upstream default branch
git checkout master if [ "$(git rev-parse HEAD)" != "$(git rev-parse $ORIGIN_BRANCH)" ]
then
git checkout -B "$(echo "$ORIGIN_BRANCH" | cut -d / -f 2-)" "$ORIGIN_BRANCH"
fi fi
git pull
git submodule sync --recursive git submodule sync --recursive
git submodule update --init --recursive git submodule update --init --recursive
popd > /dev/null popd > /dev/null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment