Git making code changes in local branch 'develop' and push to Acquia Cloud Dev I cloned Drupal 8 core and modules from my Acquia Cloud distro into my local repo.

In my local repo I have 2 branches * developand master. Currently I am in develop branch. I made some small changes to the .gitignore file and in sites/default/settings/php

(in the develop branch i want to make all my changes to code, themes and add contributed modules).

Currently i am in develop branch. When i try from Dev desktop: Push code to Cloud Dev I get this message:


  NOTE: Your locally deployed branch 'develop' doesn't match 'master'
  deployed in the Cloud environment 'dev'. You will have to deploy
  'develop' in the Cloud to see your code changes.


I know I get this message because I am currently in develop branch. But what do I have to do exactly before Push code to Cloud Dev to avoid this error message? What is the recommended procedure exactly to make changes to my code locally (on another branch) and Push code to Cloud Dev? And is it advisable to make those changes to code on another branch e.g. develop?

Update: 


I select develop in Acquia Cloud dev environment after git push
origin develop. Till when? When do i have to choose master again?
In my local repo i have added branch develop to add all my
contributed modules and to develop the frontend etc. When do i have
to merge it to master exactly? Or do i have to stay on develop
all the time?
This simply means you need your develop branch to be pushed to the remote Acquia Cloud repository.

$ git push origin develop

Once you do so, just select develop in your Acquia Cloud dev environment. You'll now by in synch between your local and remote branch and will be able to push code as you expect.

UPDATE:


Using the develop branch can be permanent or not, it's up to you.
You can, say, have develop always checked out in dev, master in
stage, and a git tag in prod. develop would then be your
cutting-edge branch while master would be safer and primarily for
QA. Sometimes, you'd have to delete develop and create it again
from master to clean things up. It's part of a normal workflow.
Don't be mistaken between a feature branch and a regular branch. develop isn't a feature branch, it's an integration branch. This means that you could have a feature branch locally called, say, twig-fixes that you would merge with develop when you're happy with the changes. You would then test your feature one last time in the develop branch locally and/or on Acquia Cloud, and then would take it from there.


NOTE: always create feature branches from master as it's your stable branch.

Example workflow:

$ git checkout master
$ git pull
$ git checkout -b twig-fixes


Do your work and commit changes to the feature branch, and, when you're ready to test your changes on the Acquia dev environment, merge your branch into the develop branch and push it to origin:

$ git checkout develop
$ git pull origin develop
$ git merge twig-fixes
$ git push origin develop


If all looks good, merge the feature branch into master using the squash option, to compact all commits into one commit only.

$ git checkout master
$ git merge --squash twig-fixes
$ git commit -m "Squashing twig-fixes"
$ git push origin master


If all looks good again in master, then you're free to delete your feature branch.