简体   繁体   中英

Rails - how to start up a local server (thin) with a specific git branch

I have a Rails 3.2.16 app with multiple git branches (for testing features). I use thin to spin up a server in development. If I have a branch called "dev" for instance and I'm currently checked out to that branch in git. By default thin will pickup whatever is in the app directory and serve it up. But what if I wanted serve up what is in the master branch. Is there any way to serve up the master branch in thin (or even in rails s so I can work with the app in that branch in a browser?

So basically I have multiple branches, but want to test the app in the browser using a certain branch. How can I do that?

locally you switch to the branch you want

git checkout master

and

rails server

bring up the app for that branch

You can

git checkout dev

or

git checkout master

at any point in order to run

rails server

for that branch

You don't even need to restart the server for simple applications.

"By default thin will pickup whatever is in the app directory..." - yes but it will do this for the branch that is currently checked out.

So basically which ever branch you are currently on is the same one that is used in your rails server as it is for looking at and editing the files locally. If you switch branch, then both your code and the server will be looking at the files as they exist in that 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM