0

I use Yeoman for deployment of my web app. As per the suggestion of the Yeoman docs, I deploy my site using git subtree, doing something like this:

  1. grunt build
  2. git add -A dist
  3. git commit -m "New release"
  4. git subtree push --prefix dist origin deploy

Then, on the staging server, the very first time I do:

  1. git init
  2. git remote add -t deploy -f origin git@github.com:cdmckay/example.git
  3. git checkout deploy

Then, every time after that I do:

git pull

However, this causes a couple things I don't like.

Firstly, my master branch now has dist folder, which I think is ugly.

Secondly, my git history gets chocked full of New release messages, as every time I want to push the Yeoman app to my staging server, I have to make another commit.

Is there a better way to set up my deployment such that I can keep the dist folder out of the master branch and get rid of the deployment commit messages?

cdmckay
  • 31,832
  • 25
  • 83
  • 114

1 Answers1

1

Is the pull ever going to need to do a content merge, or will complete replacement be enough?

Complete replacement is, on build,

git tag -f dist `git commit-tree -m - master:dist`
git push -f origin dist

and on the staging server:

git checkout -f dist  # possibly with `-f`

git doesn't attach HEAD to tags and this tag is of no-history commits, so there's nothing to get out of sync, it's a raw content push with a throwaway tag name.

jthill
  • 55,082
  • 5
  • 77
  • 137
  • It'll always be a complete replacement... but I'm starting to think maybe using git for deployment isn't the best fit? – cdmckay May 23 '14 at 20:00
  • Yep. You'll find a lot of replies on here "git isn't a deployment server", but it's fallen out of fashion because so many people want to use what's right in front of them and git's a unix tool: like many of them, you can bludgeon it into doing just about anything. All the same, this does work. – jthill May 23 '14 at 20:04
  • edit: hang on, this isn't the question I thought, [I found a better way](http://stackoverflow.com/a/23837283/1290731). – jthill May 23 '14 at 20:06