add git bootstrap

This commit is contained in:
JMARyA 2024-03-03 03:37:02 +01:00
parent 84b9c8fa5e
commit e94babad1e
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

24
zsh/git.zsh Normal file
View file

@ -0,0 +1,24 @@
# 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
}