Git is distributed version control system focused on speed, effectivity and real-world usability on large projects.
- Git does most of its operations without any network connection required
- Git keeps track of changes to a file rather than it entire history of specific files.
Like most other modern version control systems, Git gives each developer a local copy of the entire development history, and changes are copied from one such repository to another.
- Main Git Website - http://git-scm.com/
- Git Quickstart - http://rogerdudler.github.com/git-guide/
- Pro Git - http://progit.org
We still mainly use SVN at 14four as our main versioning system, but you can still use git as a great utility for the deployment of applications. This is the basic work flow for deploying applications.
- cd /local/path
- git init (setup .gitignore for deployment )
- git add . (add all files that are currently in project)
- git commit -m ‘My Commit Message’)
- cd /server/path
- git init
- git pull /local/path
With these commands you can setup an new git repository, add all your files, and push to the server. Now any changes you make, can be easily added to the deployment server without manually having to go through each directory and pick and choose what files you need to update.
With the help of the .gitignore file you can make sure only files you want to update go to the remote server, especially those pesky ._ files. You can even use svn and git in the same directory by ignoring .svn files.
If you need to connect through ssh, or ftp, you should still be able to deploy files through this same process, but this especially handy when on the same network.
An easier way
Althought this is pretty simple to do, it could still be tedious at times, so to fix this, I wrote a couple of simple shell scripts that allow you to easily pull or push file to our from servers with a single command once you setup up the config file.
sh git-push.sh or sh git-pull.sh
Git er done - Real life work flow
There are some project where i have to develop directly on a development server because of the need to use .Net to build a website. This work flow is especially handing when trying to do so.
When working on the front end of a .Net MVC website, front end developers really only need to touch two folders, assets and Views, but there are a lot of other files that we won’t really need to touch, so we set up our .gitignore file to only track these files, and then we can easily deploy as needed.
Then anytime I need to push or pull any files, i just fire off one of my the shell commands, and everything is synced.