Jump to content

Deploying with Git


Drongo_III

Recommended Posts

Hello

 

I want to deploy an application hosted on Git Hub.  It's my first time doing it this way. ()

 

I've cloned the application on my web server and everything works great.  I've done some additional changes locally and pushed them up to Git Hub along with a tag (called testTag).  I understand tags are common practice to mark a release point.

 

The bit I'm confused by is how I deploy that specific tag to my server?  I want to be able to checkout the tag to my server's master branch but when I checkout the tag (code below), it kicks me off the branch. Not what I was hoping for.

git fetch --all --tags --prune
git checkout testTag

Any advice appreciated!  And I know this isn't strictly PHP but I couldn't see a forum relevant to this. If it's any consolation it is a PHP application I'm trying to deploy  :tease-01:

 

Drongo

Link to comment
Share on other sites

I won't claim to know how to do it professionally ("continuous integration" is what that's called) but

 

Yes, tags can mark releases, but it's easier to deploy with a branch: make one just for released code and merge into it when you're ready. You can then put your tags on that, but deployment would be just checking out the new code. You can even stick the fetch+checkout commands in a cronjob.

 

Make sure you don't have the .git directory in the web root - really, you should have everything set up like that to begin with anyways, with source code separate from the web-accessible files and whatnot.

 

And another thing: do a detached checkout from origin instead of creating local branches.

git checkout --detach origin/release
(if "release" is the name of the release branch)

 

One more thing. If you go automated, be damn sure you have great testing in place first.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.