I am trying to create a Local -> Development -> Production environment with the help of Git(hub). But I cannot find the right way to do this.
These are the levels:
This is the workflow I have in mind:
1) I make my changes locally, first in feature
branches.
2) Merge feature
branch with develop
branch.
3) Push to Github repository.
4) Pull the develop
branch to my test remote server. Test if everything is ok.
// Development server
ssh username@[IP_ADDRESS]
cd /to/my/git/folder
git pull https://www.github.com/user/repo
5) Merge my develop branch into master
.
6) Pull my master
branch on my production remote server.
// Production server
ssh username@[IP_ADDRESS]
cd /to/my/git/folder
git pull https://www.github.com/user/repo
The Problem
The problem I am facing is that when I git pull
my repo on the development server I only get my master
branch. But I want my develop
branch on my development server and my master
branch on my production server.
Is this even an efficient workflow or do I need to design it another way?
In the development server you can do git pull && git checkout <development-branch-name>
It will update the git repo with the changes and switch the repo to use the development branch.
Take a look at this question to know how to configure your .gitconfig
file to track the remote branch - Git: which is the default configured remote for branch?
Regarding the workflow, that is how things are done in places that I have worked. So, I guess it seems fine.
I solved the problem as follows:
> ssh username@[IP_ADDRESS]
> cd /to/my/git/folder
> git init
> git remote add origin https://github.com/user/repo.git
> git pull origin develop
I had to set my remote so I was able to pull the right develop branch.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.