Skip to content
Open
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
22 changes: 16 additions & 6 deletions github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,26 @@ fi

# Checkout the repo & enter it
if [ -d "${REPO_LOCATION}" ]; then
cd $REPO_LOCATION
git checkout master;
git pull;
# Repo already exists
cd "$REPO_LOCATION"
# Cleanup current working tree including untracked files
git reset --hard HEAD
git clean -dx --force
# Detach in case we're on a local branch
git checkout --detach
# Delete all local branches to not have to merge them all
for branch in $(git for-each-ref --format="%(refname:strip=2)" refs/heads); do
git branch -D $branch
done
# Update from remote
git fetch --force --all --tags --prune --prune-tags
else
git clone $REPO $REPO_LOCATION;
cd $REPO_LOCATION;
git clone "$REPO" "$REPO_LOCATION";
cd "$REPO_LOCATION";
fi

# Checkout the correct branch
git checkout $BRANCH
git checkout "$BRANCH"

# Exit the repo
cd -
Expand Down