4

I am working on a small web project and I am trying to do it right. I learned how to use git/github so I can work with multiple-users on the same code (right now it is only me on multiple-computers).

my question is - what is the right way to upload the files to the web?

I can copy-paste the entire folder through file-zilla but that doesn't seem to be the right way. Is there a way to deploy latest version through git? github? notepad++ (which I work on) or aptana?

where do I start?

Alon
  • 7,618
  • 18
  • 61
  • 99
  • 1
    http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export#answer-163769 – PeeHaa Apr 21 '12 at 11:33
  • 1
    There is no absolute "right way"; there is only the way that suits you and your project best. The right tool for the job (and often for the tool user too). – liquorvicar Apr 21 '12 at 11:42

4 Answers4

2

Your mileage and strategy may vary depending on your workflow. What I describe below is working for us at my current company, but feel free to experiment and find what works for you.

In our Git repo, we have a "master" branch. All new development, as well as major bug fixes, occur in branches off of the "master" branch. When they're ready, they are merge into master. The idea here is that no unfinished features or knowingly buggy code is ever in master (in theory…).

When we want to make a new "release" - a new version of the code on our web site - I contact the other developers and make sure the stuff they were working on which should be done has been merged into master and pushed to the GitHub repo. I'll make sure my local copy of the repo is up-to-date by pulling and merging the changes in master to my local repo, run any necessary database update scripts, then test locally. If something needs fixing, I'll fix it myself or ask the responsible developer to fix it. If things look good, then I'll log in to our staging server (which is actually on our live server, but uses a separate database and a non-publicly-accessible URL), pull the code from the GitHub repo to the repo there, update the database, and test again there. That way, any bugs which might happen on the live server but isn't happening to me on my local dev server can be caught.

If things still look good, then I'll tag the relevant commit in the repo with an applicable tag, like BETA-4 or v1.8, on my local dev repo and push the tag. Then I'll log in to the live server, back up the database, pull the master branch from GitHub, and then use git checkout to check out the tag I just created. That's the trick there; if you have a tag (other than HEAD) checked out, then Git will keep the state of the repo to the files as of the commit that tag points to until you check out another tag. Then I run the update scripts on the live server, and there you go.

Git is a powerful tool, and all the people who try to tell you it's easy to use are oughtright liars. I highly recommend you get a good book on it if you're a newbie. Hell, I've been using it almost daily for almost two years now, and it still surprises me at times. O'Reilly's book is decent as usual, and I find SourceTree to be a nice OS X GUI app (you should of course learn to use the CLI interface, particularly so you can log into remote servers and do pulls and such via SSH, but a nice GUI can make tasks such as doing a commit in which you only commit some of the changed files in a repo much more pleasant).

Garrett Albright
  • 2,844
  • 3
  • 26
  • 45
0

there are professional deploy tools out there. imo the best one is capistrano if you do not develop with ruby on rails you additionally need railsless-deploy.

with such systems you can easily deploy your application from a git repository to any server you have access to. it requries a bit of configuration but you'll get it...

Andreas Linden
  • 12,489
  • 7
  • 51
  • 67
0

If you have root access to the server you can use svn or git and deploy the current state to your online project

alphanyx
  • 1,647
  • 2
  • 13
  • 18
0

You can have a look to the html5boilerplate build script http://html5boilerplate.com/docs/Build-script/. It does a lot of things but this is a valuable answer to your question.

pomeh
  • 4,742
  • 4
  • 23
  • 44