Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

Deploying sass developed site via github.

Hi all, newbie to git and github so apologise if this is a real dumb question but I can't find an answer anywhere.
I have been doing some online courses/code along exersises and am ready to start some real stuff.
My development workflow at the moment is as follows.
1. Create a master blank git repo on my local nas.
2. Clone it on my dev machine.
3. Develope using npm/sass for my css and to minify my code.
So, I end up with a lot of files not required on the production/hosting service. I have a .gitignore for the node folder.
I want to then deploy only the required files via github.
Is there a way to do this easily?
Short of having to edit the ignore file everytime?
Many thanks for any and all help.
1 Reply
Community Manager
Message 2 of 2

Re: Deploying sass developed site via github.

There isn't a way to do what you want easily, no. There is a way to do it, however, that is often used to publish things to servers and is used by some for GitHub Pages websites. It boils down to the following process:

 

  1. Create a temp directory somewhere outside of your local repository
  2. Copy only the files that you want to deploy from your local repository to the temp directory (be certain to create the directory structure you desire when doing so)
  3. In the temp directory execute the following:
  4. git init
    git checkout --orphan deploy
    git add .
    git commit -m "Latest code"
    git remote add origin [repository-url]
    git push origin deploy --force

What this does is creates an "orphan" branch that is unrelated to the history of the rest of your repository. You then store the files that you want to deploy there, keeping them separate from your source code.

 

Let us know if you have more questions.