I’ve just downloaded and installed github on my Mac and signed up for an account with github so that we can get one of our websites under version control. I have setup my first repository and loaded all my files in to there.
My understanding is that any changes I make on my local copy (i.e. my Mac) I then have to commit to the live repository on github, correct?
How can I commit changes to our live website? I know how to commit to the github live directory, but can I commit to the live website at the same time. I guess this is the part I don’t really understand.
I’ll try to give you a few pointers here. With regard to your questions:
Actually not quite. There is a difference between the version control system GIT and the online service GITHUB. Github is just a website that hosts GIT repositories, but you can use GIT without using GITHUB at all. However, if you decide to use it then yes, you will end up committing your files and pushing them over to github. You have to commit locally first and then do a push to github.
You don’t commit to the live website as such. The way I do it is like this:
Make changes that you are happy with - do a local commit to git on your local machine.
Push those changes to github.
ssh onto the website server and do a pull from github and then do an update - this will update all your files on your website.
Your website is essentially just another repo - so just as you all commit files to github and then share changes with one another that way, your website is effectively just another repository and you treat it in the same way.
It’s a bit difficult to initially get your head around it, but once you understand it you’ll never go back. I’d recommend learning branching and merging too, and before you know it you’ll be using it like a pro