Website Version Control
We are bringing the static and custom files on the website into Git to version control them. They are in this repository:
https://github.com/NottingHack/website
None of the Wordpress or Wiki system files are included in the repository, this allows those systems to be updated automatically, without engaging the version control.
Setting up
Set up Git on the Web Server
Pull the remote repository
Once the repository on Gtihub is set up and populated, we need to set up the server to pull from it, without deleting loads of things off the server. We can't just do a
git clone
as git will complain about untracked files, overwriting, etc. So we need to be a bit sneaky about it.
We are going to be doing this in the main directory (above public_html) as we are also tracking files outside the webroot
First, we create a .gitignore file in the main directory, with just these contents:
*
This tells git to ignore (and overwrite) and files it likes. It also won't ever complain about untracked files during a commit (although we won't be commiting from here anyway). DANGER do not so this on a local filesystem, unless you like losing files.
Now set the main directory as a git repository
git init
Then add the remote
git remote add origin git@github.com:NottingHack/website.git
Pull the data from git (this won't change any files yet).
git pull
Finally, make a new master branch and set it to track the origin master. This will overwrite any files that exist on the webserver with the tracked files, without affecting untracked files. This is what would fail if we hadn't already made the .gitignore file
git checkout --track origin/master