Create new project from clone - clone repo, rm .git, git init, sed files, git commit
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

git-clone-init - create new project from clone

Creates a new git-clone-init bash script in your path which can be used to quickly create a new project from a git clone. See below for details of what it does.


npm install -g git-clone-init # install once

# when you want to create new project, cd to a parent directory
# run git-clone-init with gitPath and your desired projectName
# it clones and inits into a new folder projectName
git-clone-init projectName

# You may use gitURLs or local paths to a git project
git-clone-init ~/projects/base-react projectName


  • requires bash

What it does

This is a rough summary of the commands performed by git-clone-init, see git-clone-init.bash for full details.


# ... verify params, ensure target directory doesn't exist

# exit on any error
set -e

# clone and re-init
git clone "$baseRepo" "$projectName"
cd "$projectName"
rm -rf .git
git init

# replace PROJECT_NAME with projectName in a few files
sed -i'.orig' "s/PROJECT_NAME/$projectName/g" package.json
rm package.json.orig

# initial commit
git add .
git commit -m "Initial commit"


In order to create new projects, I need a way to quickly setup a structure and copy in some files. I wanted something easier and lighter than a yeoman generator and since I normally just do this with git clone, I figured I could easily wrap up a few commands in this bash script.

It does simple inline replace with sed for PROJECT_NAME in package.json and

If you need anything more complex, check out yeoman generators.