24 lines
No EOL
548 B
Bash
24 lines
No EOL
548 B
Bash
# bootstrap REPO NAME
|
|
# Create new repository from a base git repo
|
|
function bootstrap() {
|
|
local BASE="$1"
|
|
local NAME="$2"
|
|
|
|
if [ -z "$BASE" ]; then
|
|
echo "Please provide the base repository URL."
|
|
return 1
|
|
fi
|
|
|
|
if [ -n "$NAME" ]; then
|
|
git clone "$BASE" "$NAME"
|
|
cd "$NAME"
|
|
rm -rf .git
|
|
git init --quiet
|
|
else
|
|
git clone "$BASE"
|
|
local REPO_NAME=$(basename "$BASE" | sed 's/\.git$//')
|
|
cd "$REPO_NAME"
|
|
rm -rf .git
|
|
git init --quiet
|
|
fi
|
|
} |