SeaSky
SeaSky

Reputation: 1312

Newbie to GIT - deploying from Github to Google Compute Engine / AWS

I am new to GIT and am still learning the basics. I have however been able to successfully create a repository at github.com using the GUI tool and have 4 branches for my project

1. Master - default 2. Local - which is the copy of code that runs on my local machine 3. GCE - DEV - which is the copy I'd like to deploy onto my google compute engine instance

Question 1 - what is the simplest way to move code from one branch to another? In other words once I test and certify code in my local branch I'd like to move it to the GCE DEV branch from where I can deploy to my server. How do I move an entire branch vs just a few files?

Question 2 - currently I SSH into my google compute instance and then use git clone to copy over code to my folder there. Is there a better way?

Question 3 - My folder on google compute is not added to GIT - should I add it to GIT? Or should I leave it alone and just continue to clone code into like mentioned in step #2

Question 4 - subjective - but is this a good way to organize my code? The reason I did it this way is to ensure that I have code versions in every environment and I can track the movement of code across environments via branches in GIT

Again - I am new to GIT so I apologize in advance if I am making fundamental errors or assumptions but help is appreciated.

Upvotes: 4

Views: 971

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 993095

  1. The way to move code from one branch to another is to merge. See Pro Git, the chapter on Basic Branching and Merging for starters.

  2. Yes, you only need to create a clone once. After you have created a clone, you can use git pull to update the files on your server.

  3. It's unclear what you mean by "added to Git".

  4. Branches are for tracking different paths of development, rather than for separating code between physical (different machine) boundaries. See A successful Git branching model for a description of "git flow", which is a good way to think about branches.

Upvotes: 2

Related Questions