• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 581
  • Last Modified:

Viewing local html files on a local git branch

I have been using Git and TortoiseGit for a few months now and have questions on it's functionality.

Currently we use it exclusively for web development.  We push the branch to a Beansstalk repo and it deploys it to our webserver (www.mydomain.com).  We also push branches (i.e. dev) to beanstalk that in turn pushes it to a subdomain for development/testing (dev.mydomain.com).

In order to view web pages we are working on by pushing them to the repo and deploying to our dev domain seems very inefficient.  I would like to be able to view the dev branch files on my machine through a local web server as I change them prior to making commits.  I'm sure this is simple however with Git involved I have some questions.

My Question(s):
1) If I have my files (on a local network file server) switched to a dev branch, can I run a local (client) webserver and view the dev branch files through a local (client) web browser?  I assume yes, and that when I switch back to the master branch, the files viewed in the web browser will be of the master branch.
2) Can I run a webserver on the network file server that the files reside on and view the branch, or will the server only serve the master files?  

I'm guessing it is easiest/best if I run a client webserver on the machine that is running and working on the git versioned files...

Any advice that would be different and better?

Thank you for your help!  =)
1 Solution
EdgeTodAuthor Commented:
To answer my own question:

Yes, you can setup a local web server on the client machine and serve the files to a browser.  The GIT branch that is active will be the files that are served.  If you switch to a different branch, those files will now be served if they are different.

A great way to preview changes before committing to a git branch and pushing to the repository.

If using XAMPP:
Make sure that the httpd.conf configuration file points to the network directory using the correct slashes (not cut and paste from Windows or a network drive):
DocumentRoot "//CASCADESVR/Website"
<Directory "//CASCADESVR/Website">
NOT Correct:
DocumentRoot "\\CASCADESVR\Website"
<Directory "\\CASCADESVR\Website">
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now