Skip to content

Commit

Permalink
Merge pull request #52 from octoposprime/renew-as-44-script-refresh-fix
Browse files Browse the repository at this point in the history
Refreshing repository cloning script
  • Loading branch information
baburakbas authored May 14, 2024
2 parents 8bd05f4 + 462cdd1 commit f407413
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions dev/fetchanges.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# GitHub repository URL
repo_url="https://github.com/octoposprime/op-infra.git"

# Branch name that currently using
branch="phase1"

# Directory to clone the repository into
clone_dir="$HOME/k8s/project/op-infra"

# Repository cloning or updating process
if [ ! -d "$clone_dir" ]; then
echo "Repository not found locally. Cloning into $clone_dir..."
git clone --branch "$branch" "$repo_url" "$clone_dir" --recursive
cd "$clone_dir" || exit
else
echo "Repository already exists. Fetching updates..."
cd "$clone_dir" || exit
git fetch origin
git checkout "$branch"
git pull origin "$branch"
fi

# Submodules update
git submodule update --init --recursive

# Show changes
echo "Changes in repository:"
git log --oneline --decorate --graph -n 5

# Script completed message
echo "Repository is up to date in $clone_dir."

0 comments on commit f407413

Please sign in to comment.