Search code examples
gitversion-controlworkflowstaging

git staging server


We are working on setting up a git environment, and for our workflow, we would like to do the following:

enter image description here

The issue is that I want to be able to easily pick and choose which changes I want to push to production from staging. For example, if dev1 is working on feature 1 and dev2 is working on feature 2, I might only want to push the changes of feature 1 to production. Is this possible? I might even have a case where dev1 is working on feature 3 and feature 4, but I only want to push feature 4 to production.


Solution

  • This is very common. I do this frequently.

    The approach to use is to have developers create what are called feature branches (or just branches.

    This is done using the command:

    git checkout -b my_new_feature
    

    Then they can work on the feature and everyone else can get that code, but it won't mix with any other branches until that branch is merged into your master branch, like so:

    git checkout master
    git merge my_new_feature
    

    Different developers can work on different features however long it takes, then you can merge to master (and push to staging) whenever it makes sense.