Think Labs is an ongoing effort by Seven2 to provide research and educational opportunities in the web development and mobile field. To see what we’ve been cookin’ up, check out our blog postings.

Created by
Seven2 Login

Team Think Labs | Git with it! Use git for website deployment.
single,single-post,postid-1390,single-format-standard,ajax_fade,page_not_loaded,,,wpb-js-composer js-comp-ver-4.2.3,vc_responsive

Git with it! Use git for website deployment.

Git Started

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.

Distributed Development

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.

Git Going


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.

Terminal Commands:

  1. cd /local/path
  2. git init (setup .gitignore for deployment )
  3. git add . (add all files that are currently in project)
  4. git commit -m ‘My Commit Message’)
  5. cd /server/path
  6. git init
  7. 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.

Example .gitignore:

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.

Example .gitignore:


Then anytime I need to push or pull any files, i just fire off one of my the shell commands, and everything is synced.