I run a Node.js app in AWS EC2. The source of this app are pulled from the master of a bitbucket server through git, then the modules are installed and the app is ran in the AWS EC2.

I want do some tests of new features, I created a development branch from the master on that bitbucket server, add some new modules into the development branch. 

Expected result:
***In AWS EC2, I want to change the remote repository from master branch to development branch, pull the source from the development branch, then install the new modules and run the new app. After test, I want to change the remote repository back to master branch and roll back all source code to exactly the same as that on the master.*** 

Could you please tell how to achieve above expected result using git command?