I’m a single developer that has always just developed over FTP to a development server and then moved the files into production when ready. I’ve been interested in using git and GitHub for quite a while now, and I’ve finally got a good excuse now with a new project I’m starting. However, it seems tedious to have to do:
git add file1.php
git add file2.php
git commit -m 'updated file1 & 2'
git push origin master
Then after that is in the repo on GitHub, SSH into my server, go to the correct directory, and do:
git pull
each time I make any change to the code. This is apposed to editing in something like Coda and then just clicking command+S.
Is there a better (maybe more automated) way of doing this? I know there is a GitHub for Mac app which is quite nice and helps with the first part, but I still have to login to SSH to update anything, which can get tedious after a few dozen updates in an afternoon.
I’ve also seen that I can add a post-hook, so I could call a PHP script to execute the git pull on each commit, but I feel like there could be some security issues with that, and not to mention the issue with that script failing since it can’t enter the passphrase.
I strongly suggest you read the ProGit book http://progit.org/
No, there are much faster ways of doing this.
Once you have the files added, you can simple
git commit -a -m "Change descriptions"In order to add the files, you can
git add .which will recursively add all non-ignored files.If you have a tracking relationship set up with your branches, all you need to say is
git push. Only if someone else makes a change do you need togit pullThere are of course many IDEs which will help manage git, and git guis of various breeds.
https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools
But really there are only a handful of commands you need to know to do it from the command line.
These commands you will be using every single day
These commands you will use only on setup or rarely
I would like to reiterate that git is not a web deployment system. However, if you are trying to do something like that, some people have had success with http://toroid.org/ams/git-website-howto