Skip to content

Instantly share code, notes, and snippets.

@thomas4g
Last active September 15, 2015 08:07
Show Gist options
  • Save thomas4g/5b1a86e9090d5a418ba8 to your computer and use it in GitHub Desktop.
Save thomas4g/5b1a86e9090d5a418ba8 to your computer and use it in GitHub Desktop.
Comparison of Templating Options for Git

#Raw Git: Setup: None

Template is stored at: https://github.gatech.edu/cs1331/hw-template ##Creating a new one from template:

  1. Create hw-name on github
  2. Clone repo onto local box, e.g git clone https://github.gatech.edu/cs1331/hw-name.git
  3. cd hw-name and git remote add template https://github.gatech.edu/cs1331/hw-template.git
  4. git pull template master
  5. Edit the files that have templated out values
  6. Add, commit, push, etc.

##Updating if the template changes: git pull template master

##Pros

  • Keeps template changes in history
  • Easy to update if template changes
  • Nothing to install

##Cons

  • Have to manually fill in template first time
  • More verbose; could be a bit "hardcore" for git newbies

#giter8 Setup: Install g8 from https://github.com/n8han/giter8, ~3 minutes (appears to be harder on Windows)

Template is stored at: https://github.com/cs1331/hw-template.g8

##Creating a new one from template:

  1. Create hw-name on github
  2. Clone repo onto local box, e.g git clone https://github.gatech.edu/cs1331/hw-name.git
  3. g8 cs1331/hw-template & plug in values. This is super snazzy and way nicer than step #4 of raw git
  4. cd hw-name and Add, commit, push, etc.

##Updating if the template updates: g8 -f cs1331/hw-template and re-plugin values. BEWARE: this will completely overwrite templated files.

##Pros

  • Super slick setup
  • Automated template plugging in

##Cons

  • No history of template changes
  • Have to install g8
  • No ability to update if template changes! The only option is to completely recreate from template, which overrides stuff.

#activator Setup: Download Activator from https://www.typesafe.com/activator/download, ~5 minutes (have to manually add to path)

Template is stored at: https://github.gatech.edu/cs1331/hw-example

##Creating a new one from template:github

  1. Create hw-name on github
  2. activator new hw-name cs1331-hw1
  3. cd hw-name, git init, and git remote add origin https://github.gatech.edu/cs1331/hw-name.git
  4. Make any changes necessary
  5. Add, commit, etc
  6. On the first push, git push -u origin master

##Updating if template changes:

##Pros

  • Slick setup / initialization
  • Can use github hooks to autoupdate the activator repo when you push to the template repo

##Cons

  • pollutes project with activator binaries, LICENSE, and "tutorial"
  • No history of template changes
  • Have to install activator
  • No ability update if template changes
  • Have to manually fill in template, other than the project name, which activator fills in for you
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment