Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git branches in separate folders #38

Open
VladimirCores opened this issue Jun 16, 2015 · 2 comments
Open

Git branches in separate folders #38

VladimirCores opened this issue Jun 16, 2015 · 2 comments

Comments

@VladimirCores
Copy link

i would like to send my project to separate folders on ec2 linux machine and run them as a simultaneous processes, its production and development. How can i do that?

Best,
Vladimir Minkin

@yyx990803
Copy link
Owner

I think you can just create two apps on the server, then in your local repo, add them as different remotes. You can just push to different remotes from different branches.

@VladimirCores
Copy link
Author

I done it with git hooks like that

prodpath="/home/ec2-user/<path_to>/production"
devpath="/home/ec2-user/<path_to>/development"
while read oldrev newrev ref
do
branch=echo $ref | cut -d/ -f3
if [[ "master" == "$branch" ]]; then
git --work-tree=$devpath checkout -f master
restart=0
echo 'Changes pushed development.'
elif [[ "production" == "$branch" ]]; then
restart=1
git --work-tree=$prodpath checkout -f production
echo 'Changes pushed to production.'
fi
done
pm2 restart $restart

where $restart may be the name of process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants