Reputation: 23
I just graduated from college and started working on a three person development team. The code base is not currently under any version control system. Our codebase is in classic ASP and Adobe Contribute was integrated to allow content creators to update their own content. Right now we develop directly on the production website by mapping the web server's drive to our workstation. I strongly believe that we should integrate some form of version control into our workflow and discontinue the practice of developing on the production web server in favor of local development.
I imagine the workflow working something like the following:
My train of thought may be incorrect, but I am looking for recommendations from those with more experience.
Upvotes: 0
Views: 114
Reputation: 38116
Since you already have web sever, you can setup git server (remote repo) on your own server. This will make it easier to use server-side hooks for the remote repo.
The workflow for version coontrol the live web site as below:
Work on the local copy of develop remote repo -> make changes -> commit -> push to the develop remote repo -> if you are ready to deploy the changes to the website -> push change to production remote repo.
Prerequisites: two remote repo on your own server.
Setup devleop remote repo:
# go to a directory, create an empty folder
mkdir develop
cd develop
git init --bare
# assume the URL for the develop repo is www.site/develop
Setup production server:
# go to a directory, create an empty folder
mkdir production
cd production
git init --bare
# assume the URL for the develop repo is www.site/production
In your local machine, clone the develop repo and add the files you want to version control in git:
git clone www.site/develop
cd develop
# add all the files for the website which you want to manage in git
git add .
git commit -m 'message'
git push origin master
If you are already to push the files in production remote repo, you can use below commands:
git remote add prodcuton www.site/production -f
git push production master
If the changes need to push the production remote repo immediately each time after changes are pushed to develop repo, you can use post-receive hook in develop repo .git/hooks folder:
#!/bin/bash
git --work-tree=/path/to/develop --git-dir=/path/to/production checkout -f
You can also refer Simple automated GIT Deployment using Hooks and Using Git to Manage a Live Web Site.
Upvotes: 1