Newbie to GIT - Deploy from Github to Google Compute Engine / AWS
I am new to GIT and am still learning the basics. However, I was able to successfully create a repository on 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's the easiest way to move code from one branch to another? In other words, once I test and certify the code in my local branch, I would like to move it to the GCE DEV branch, from where I can deploy it to my server. How do I move an entire branch or multiple files?
Question 2 - I am currently SSH into my google instance and then use it git clone
to copy the code to my folder. Is there a better way?
Question 3 - My folder in google compute is not added to GIT - should I add it to GIT? Or should I leave it alone and just continue to clone the code as mentioned in step # 2
Question 4 is subjective - but is this a good way to organize my code? The reason I did this is to make sure I have versions of the code in each environment and I can track the movement of code across environments through branches in GIT
Again - I'm new to GIT, so apologize in advance if I make fundamental mistakes or assumptions, but welcome with gratitude.
source to share
-
The way to move code from one branch to another is by merging. See Pro Git chapter Basic Branching and Merging for Starters.
-
Yes, you only need to create a clone once. After creating a clone, you can use it
git pull
to update the files on your server. -
It's not clear what you mean by "adding to Git".
-
Branches are designed to track different development paths, not to split code between physical (different machines) boundaries. See Successful Git Branching Model for a description of git flow, which is a good way to think about branches.
source to share