In my .bashrc I have the following alias setup:
alias sitebuild='bundle exec jekyll build; git checkout gh-pages; git rm * && mkdir temp && mv * temp/ && mv temp/_site/* . && rm -rf temp && touch .nojekyll; git status; git add .; git commit -am "update"; git push --all origin'
A bit of explanation as to why I want to do this: I'm building a site using Jekyll and gh-pages
, except that I've started using plugins not supported by GitHub and so I have to build the site locally and push it to the repo (instead of letting GH build the site for me remotely).
My system is the following: I work on my site on branch static_build
, make my commits and build _site/
(containing all the final HTML). I then need to copy the contents of static_build:_site/
over to gh-pages:_site/
and push that and that only.
As far as I understand, the above command sitebuild
should do that for me (and indeed it does when I run every argument separately in the shell); yet, it doesn't.
Any idea why?
EDIT: I have a feeling it might have to do with
mv * temp/
which, when I run every command individually, outputs
mv: rename temp to temp/temp: Invalid argument
It seems that in this case the terminal complains but still complies (ls
shows that there is only temp
left in the directory), but maybe this is no longer true when the alias is run?
EDIT 2: using instead
mv `ls -A | grep -v temp` ./temp
resolves the error of moving the folder inside itself, but not the main issue.