Git
- Repositories are in the root of the home folder in a folder called 'GitRepos'
- Repos are bare repos in a folder named after the URL of the site they contain
- Site folders are the folders with the actual code files
initial setup of a site folder
NOTE: Be careful to set this all up before you start working. It will save a lot of trouble later.
Set up the Git Repo for a site like this:
- Copy the .gitignore file from the reformedperspective.ca site folder to the target site folder and edit as appropriate.
- In the actual site folder run:
git init --separate-git-dir="../GitRepos/<folder>"
Now you can do your initial commit. Make sure to run git status
first and be careful to add any files you don't want to track to the .gitignore file first before doing a commit.
working on the site files
All work on the PHP code is done using the staging site, and is pushed to GitHub and, when complete, pulled to the main site. The process is pretty straightforward:
- Make changes to the code inside
staging.reformedperspective.ca
. - Use
git add ...
to stage any changes, if necessary, andgit commit -m ...
(orgit commit -am ...
in the case of committing all changes).
Try to keep all the work on a certain thing to one or two commits. - Push the commits to GitHub using
git push
periodically. - Once the project is done and approved,
cd ../reformedperspective.ca
to switch to the main site folder and rungit pull
to fast-forward the main site files to be the same as the GitHub repo.
The easiest way to work on the staging site files on your local computer is to use VSCode with the SFTP extension. This allows you to sync the entire staging folder to your local computer (a little time-consuming) and then edit the files there as if they were on your computer.