Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions git/fetch
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ do

if [ -z "$REPO_STATUS" ]
then
info "No pending changes in working folder. Rebasing..."
git -C "$CURRENT_DIR" rebase 2>&1 || die "Could not rebase ${CURRENT_DIR}"
git -C "$CURRENT_DIR" rebase --abort > /dev/null 2>&1
if git -C "$CURRENT_DIR" rev-parse --verify '@{upstream}' > /dev/null 2>&1
then
info "No pending changes in working folder. Rebasing..."
git -C "$CURRENT_DIR" rebase 2>&1 || die "Could not rebase ${CURRENT_DIR}"
git -C "$CURRENT_DIR" rebase --abort > /dev/null 2>&1
else
info "No valid upstream for current branch. Skipping rebase."
fi
else
info "Pending changes in working folder. Skipping rebase."
fi
Expand All @@ -63,8 +68,13 @@ do
then
info "Switching to ${DEFAULT_BRANCH} branch..."
git -C "$CURRENT_DIR" checkout "$DEFAULT_BRANCH" 2>&1 || die "Could not switch to ${DEFAULT_BRANCH} in ${CURRENT_DIR}"
git -C "$CURRENT_DIR" rebase 2>&1 || die "Could not rebase ${DEFAULT_BRANCH} in ${CURRENT_DIR}"
git -C "$CURRENT_DIR" rebase --abort > /dev/null 2>&1
if git -C "$CURRENT_DIR" rev-parse --verify '@{upstream}' > /dev/null 2>&1
then
git -C "$CURRENT_DIR" rebase 2>&1 || die "Could not rebase ${DEFAULT_BRANCH} in ${CURRENT_DIR}"
git -C "$CURRENT_DIR" rebase --abort > /dev/null 2>&1
else
info "No valid upstream for ${DEFAULT_BRANCH}. Skipping rebase."
fi
else
info "Pending changes in working folder. Skipping switch to ${DEFAULT_BRANCH}."
fi
Expand Down
Loading