add git bootstrap
This commit is contained in:
parent
84b9c8fa5e
commit
e94babad1e
1 changed files with 24 additions and 0 deletions
24
zsh/git.zsh
Normal file
24
zsh/git.zsh
Normal 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
|
||||
}
|
Loading…
Add table
Reference in a new issue