Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Git cloning with template variables

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 dist
Octocat-spinner-32 docs
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 tmp
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 Gruntfile.js
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 component.json
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.md

gitemplate

Git cloning with template variables.

  • Replace variables in file names and content.
  • Optional GitHub repo init and remote origin setup.
  • Custom post-processing scripts.

Build Status

Examples

Basic clone

gitemplate --name my-new-project \
           --src git@github.com:me/my-old-template.git \
           --dst ~/dev/my-new-project \
           --desc 'gets it done' \

Auto init and set remote GitHub origin via --repo

gitemplate --name my-new-project \
           --src git@github.com:me/my-old-template.git \
           --dst ~/dev/my-new-project \
           --desc 'gets it done' \
           --repo me/my-new-project

More

Built-in variables

Case-insensitive.

gitemplate_name

Same as --name.

gitemplate_desc

Same as --desc.

gitemplate_repo

Same as --repo.

Will also trigger init and remote add origin.

gitemplate_year

Full year in local time. (Only replaced in file content.)

gitemplate_originSha

Cloned origin's commit SHA-1 (first 10 chars). (Only replaced in file content.)

gitemplate_originUrl

Cloned origin's URL. (Only replaced in file content.)

Custom vars

Will also replace in file names and content. Case insensitive.

Place in a file

gitemplate_engineVer

Or file name

/path/to/gitemplate_engineVer.js

Then replace

--json '{"engineVer":"0.10.1"}'

Post-processing scripts

Will be auto-deleted after successful execution.

Run after template variable replacement

Add an executable .gitemplate.postreplace file to the root.

node.js example that installs all dependencies and runs the unit tests:

#!/bin/sh

npm install
npm test

Installation

NPM

npm install gitemplate

API

License

MIT

Tests

npm test
Something went wrong with that request. Please try again.