How to get all metadata into Git and What will the optimal release flow using sandboxes?











up vote
1
down vote

favorite












The current development and deployment is from sandbox to sandbox and the plan is to move to git based deployments.



What is the best way to get all the metadata of an existing org into Git(bitbucket) for the first time into a master branch?



What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)



enter image description here










share|improve this question


























    up vote
    1
    down vote

    favorite












    The current development and deployment is from sandbox to sandbox and the plan is to move to git based deployments.



    What is the best way to get all the metadata of an existing org into Git(bitbucket) for the first time into a master branch?



    What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)



    enter image description here










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      The current development and deployment is from sandbox to sandbox and the plan is to move to git based deployments.



      What is the best way to get all the metadata of an existing org into Git(bitbucket) for the first time into a master branch?



      What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)



      enter image description here










      share|improve this question













      The current development and deployment is from sandbox to sandbox and the plan is to move to git based deployments.



      What is the best way to get all the metadata of an existing org into Git(bitbucket) for the first time into a master branch?



      What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)



      enter image description here







      deployment git ci






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 12 hours ago









      ab0369

      256




      256






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted











          What is the best way to get all the metadata of an existing org into Git (Bitbucket) for the first time into a master branch?




          You need to generate a package.xml to pull all the existing metadata that you're planning to manage in Git and execute a Metadata API retrieve operation. You can construct the package by hand, or use a tool to prepare one.



          One option is to use the Eclipse Force.com IDE to build the package by selecting the components that you want. You can then pull them via Eclipse, or use Workbench to perform a clean retrieve in a different working environment. Then, commit the extracted results to Git.




          What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)




          There is unfortunately nothing optimal about that sandbox layout, although the diagram you included suggests that your workflow may actually be a little more sophisticated and include individual Developer sandboxes for your developers, with a single shared sandbox for declarative work.



          Release flow and cadence is very organization- and process- specific.



          My general recommendation is to ensure that Git branches and merges are being used in a best-process fashion. With multiple Dev sandboxes feeding a single Dev Pro/integration sandbox, I would be skeptical about having developers do direct deployments to integration.



          You'll need to define an effective workflow here to ensure that developers pull and merge work from an integration branch corresponding to that sandbox (likely into their own feature or story branches) before pushing to the integration sandbox in order to avoid overwriting code. Declarative work could be pulled directly from integration and checked in on the integration branch.



          Pull requests could then be made from the integration branch to a QA branch for deployment upwards, and ultimately to master for release to production.



          Even if you're not using Salesforce DX, you want to ensure that Git is defined as the source of truth for your org, not the contents of the sandboxes. The sandbox content should always be amenable to being replaced with a deployment from one of your main branches.



          This is definitely an area where someone on your team needs to have the relevant expertise on managing a Git-based development flow - it's hard to use this kind of architecture operationally by just following instructions.






          share|improve this answer





















          • We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
            – ab0369
            12 hours ago








          • 1




            If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
            – David Reed
            12 hours ago






          • 1




            I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
            – Jayant Das
            11 hours ago










          • @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
            – David Reed
            11 hours ago




















          up vote
          3
          down vote













          While I will recommend to move to Salesforce DX, but in the traditional model of release management, your master should always be a replica of what's in Production.



          A typical flow that I have followed in the past is:





          • Create master as the gold copy. This should be your most recent stable copy of running code in Production. You will need to decide which metadata is important for you to version manage. E.g., if you are only looking to version control Apex, Triggers or you are also looking to version control say Roles, Profiles, etc. My approach to this is that what we build, is version controlled.



            As for how to extract the metadata, you will need to use the Metadata API to extract it from Production and commit it to the repo. You can use Force.com IDE for this purpose. Take a look at this link for details.



          • Create release branch from master. I have usually followed an approach here is to release only what's needed. This is because if you have too many components in the branch (say, copied over from master) which are not modified in the current release, will lead to a longer deployment time. While this depends on the approach if you want to release from master or release branch, but in general, you should only deploy what's required.

          • Developers create feature branches from the release branch, build, test and create PRs to merge to the release branch

          • Release your code from the release branch to Production

          • Merge with master after release


          There can be different ways to handle depending on the scale and choice, but typically this approach has worked well for me.



          You will definitely need to take care of other aspects, viz., code reviews, code merging, etc. but as long as you can put the process in the place, this will work fine.



          This approach also works if your developers are working out of a single sandbox, because every developer will create the feature branch and before it can be merged to the release branch and moved to upper environments, you can implement a review process to make sure the code being committed to the release branch is validated.






          share|improve this answer























          • We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
            – ab0369
            12 hours ago












          • I updated with details in the first bullet in my answer.
            – Jayant Das
            12 hours ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "459"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242629%2fhow-to-get-all-metadata-into-git-and-what-will-the-optimal-release-flow-using-sa%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted











          What is the best way to get all the metadata of an existing org into Git (Bitbucket) for the first time into a master branch?




          You need to generate a package.xml to pull all the existing metadata that you're planning to manage in Git and execute a Metadata API retrieve operation. You can construct the package by hand, or use a tool to prepare one.



          One option is to use the Eclipse Force.com IDE to build the package by selecting the components that you want. You can then pull them via Eclipse, or use Workbench to perform a clean retrieve in a different working environment. Then, commit the extracted results to Git.




          What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)




          There is unfortunately nothing optimal about that sandbox layout, although the diagram you included suggests that your workflow may actually be a little more sophisticated and include individual Developer sandboxes for your developers, with a single shared sandbox for declarative work.



          Release flow and cadence is very organization- and process- specific.



          My general recommendation is to ensure that Git branches and merges are being used in a best-process fashion. With multiple Dev sandboxes feeding a single Dev Pro/integration sandbox, I would be skeptical about having developers do direct deployments to integration.



          You'll need to define an effective workflow here to ensure that developers pull and merge work from an integration branch corresponding to that sandbox (likely into their own feature or story branches) before pushing to the integration sandbox in order to avoid overwriting code. Declarative work could be pulled directly from integration and checked in on the integration branch.



          Pull requests could then be made from the integration branch to a QA branch for deployment upwards, and ultimately to master for release to production.



          Even if you're not using Salesforce DX, you want to ensure that Git is defined as the source of truth for your org, not the contents of the sandboxes. The sandbox content should always be amenable to being replaced with a deployment from one of your main branches.



          This is definitely an area where someone on your team needs to have the relevant expertise on managing a Git-based development flow - it's hard to use this kind of architecture operationally by just following instructions.






          share|improve this answer





















          • We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
            – ab0369
            12 hours ago








          • 1




            If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
            – David Reed
            12 hours ago






          • 1




            I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
            – Jayant Das
            11 hours ago










          • @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
            – David Reed
            11 hours ago

















          up vote
          3
          down vote



          accepted











          What is the best way to get all the metadata of an existing org into Git (Bitbucket) for the first time into a master branch?




          You need to generate a package.xml to pull all the existing metadata that you're planning to manage in Git and execute a Metadata API retrieve operation. You can construct the package by hand, or use a tool to prepare one.



          One option is to use the Eclipse Force.com IDE to build the package by selecting the components that you want. You can then pull them via Eclipse, or use Workbench to perform a clean retrieve in a different working environment. Then, commit the extracted results to Git.




          What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)




          There is unfortunately nothing optimal about that sandbox layout, although the diagram you included suggests that your workflow may actually be a little more sophisticated and include individual Developer sandboxes for your developers, with a single shared sandbox for declarative work.



          Release flow and cadence is very organization- and process- specific.



          My general recommendation is to ensure that Git branches and merges are being used in a best-process fashion. With multiple Dev sandboxes feeding a single Dev Pro/integration sandbox, I would be skeptical about having developers do direct deployments to integration.



          You'll need to define an effective workflow here to ensure that developers pull and merge work from an integration branch corresponding to that sandbox (likely into their own feature or story branches) before pushing to the integration sandbox in order to avoid overwriting code. Declarative work could be pulled directly from integration and checked in on the integration branch.



          Pull requests could then be made from the integration branch to a QA branch for deployment upwards, and ultimately to master for release to production.



          Even if you're not using Salesforce DX, you want to ensure that Git is defined as the source of truth for your org, not the contents of the sandboxes. The sandbox content should always be amenable to being replaced with a deployment from one of your main branches.



          This is definitely an area where someone on your team needs to have the relevant expertise on managing a Git-based development flow - it's hard to use this kind of architecture operationally by just following instructions.






          share|improve this answer





















          • We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
            – ab0369
            12 hours ago








          • 1




            If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
            – David Reed
            12 hours ago






          • 1




            I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
            – Jayant Das
            11 hours ago










          • @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
            – David Reed
            11 hours ago















          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted







          What is the best way to get all the metadata of an existing org into Git (Bitbucket) for the first time into a master branch?




          You need to generate a package.xml to pull all the existing metadata that you're planning to manage in Git and execute a Metadata API retrieve operation. You can construct the package by hand, or use a tool to prepare one.



          One option is to use the Eclipse Force.com IDE to build the package by selecting the components that you want. You can then pull them via Eclipse, or use Workbench to perform a clean retrieve in a different working environment. Then, commit the extracted results to Git.




          What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)




          There is unfortunately nothing optimal about that sandbox layout, although the diagram you included suggests that your workflow may actually be a little more sophisticated and include individual Developer sandboxes for your developers, with a single shared sandbox for declarative work.



          Release flow and cadence is very organization- and process- specific.



          My general recommendation is to ensure that Git branches and merges are being used in a best-process fashion. With multiple Dev sandboxes feeding a single Dev Pro/integration sandbox, I would be skeptical about having developers do direct deployments to integration.



          You'll need to define an effective workflow here to ensure that developers pull and merge work from an integration branch corresponding to that sandbox (likely into their own feature or story branches) before pushing to the integration sandbox in order to avoid overwriting code. Declarative work could be pulled directly from integration and checked in on the integration branch.



          Pull requests could then be made from the integration branch to a QA branch for deployment upwards, and ultimately to master for release to production.



          Even if you're not using Salesforce DX, you want to ensure that Git is defined as the source of truth for your org, not the contents of the sandboxes. The sandbox content should always be amenable to being replaced with a deployment from one of your main branches.



          This is definitely an area where someone on your team needs to have the relevant expertise on managing a Git-based development flow - it's hard to use this kind of architecture operationally by just following instructions.






          share|improve this answer













          What is the best way to get all the metadata of an existing org into Git (Bitbucket) for the first time into a master branch?




          You need to generate a package.xml to pull all the existing metadata that you're planning to manage in Git and execute a Metadata API retrieve operation. You can construct the package by hand, or use a tool to prepare one.



          One option is to use the Eclipse Force.com IDE to build the package by selecting the components that you want. You can then pull them via Eclipse, or use Workbench to perform a clean retrieve in a different working environment. Then, commit the extracted results to Git.




          What will be the optimal release flow, if people are developing or configuring out of single sandbox (I know this is not ideal)




          There is unfortunately nothing optimal about that sandbox layout, although the diagram you included suggests that your workflow may actually be a little more sophisticated and include individual Developer sandboxes for your developers, with a single shared sandbox for declarative work.



          Release flow and cadence is very organization- and process- specific.



          My general recommendation is to ensure that Git branches and merges are being used in a best-process fashion. With multiple Dev sandboxes feeding a single Dev Pro/integration sandbox, I would be skeptical about having developers do direct deployments to integration.



          You'll need to define an effective workflow here to ensure that developers pull and merge work from an integration branch corresponding to that sandbox (likely into their own feature or story branches) before pushing to the integration sandbox in order to avoid overwriting code. Declarative work could be pulled directly from integration and checked in on the integration branch.



          Pull requests could then be made from the integration branch to a QA branch for deployment upwards, and ultimately to master for release to production.



          Even if you're not using Salesforce DX, you want to ensure that Git is defined as the source of truth for your org, not the contents of the sandboxes. The sandbox content should always be amenable to being replaced with a deployment from one of your main branches.



          This is definitely an area where someone on your team needs to have the relevant expertise on managing a Git-based development flow - it's hard to use this kind of architecture operationally by just following instructions.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 12 hours ago









          David Reed

          28.5k61746




          28.5k61746












          • We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
            – ab0369
            12 hours ago








          • 1




            If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
            – David Reed
            12 hours ago






          • 1




            I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
            – Jayant Das
            11 hours ago










          • @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
            – David Reed
            11 hours ago




















          • We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
            – ab0369
            12 hours ago








          • 1




            If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
            – David Reed
            12 hours ago






          • 1




            I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
            – Jayant Das
            11 hours ago










          • @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
            – David Reed
            11 hours ago


















          We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
          – ab0369
          12 hours ago






          We want to pull all the metadata components (except - developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…) that can be deployed into the master branch. Since we have limits (You can retrieve and deploy up to 10,000 files or 400 MB) trying to figure out the best process to get all the metadata into master branch, we have huge number of components like classes, triggers, report types, reports, vf pages, lightning components, validation rules, custom objects, fields, email alerts, wfrules, process flows etc. Planning to use sfdx cli mdapi retreive
          – ab0369
          12 hours ago






          1




          1




          If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
          – David Reed
          12 hours ago




          If your org exceeds the limits of the Metadata API, you'll need to batch your retrieves by building multiple package.xml files to extract specific groups of metadata components.
          – David Reed
          12 hours ago




          1




          1




          I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
          – Jayant Das
          11 hours ago




          I have seen that when master grows over time as it's the ultimate source of truth, deploying from master leads to an extended deployment time. From the process I usually follow is to deploy from a release branch which consists only of what is required for the release (sort of delta deployment approach), instead of overwriting Production with what's not needed. It though drills down to the process being followed varying from place to place.
          – Jayant Das
          11 hours ago












          @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
          – David Reed
          11 hours ago






          @JayantDas It's also possible to do a delta deploy off a commit range on master via something like git diff HEAD~1 --name-only --diff-filter=ACM. Either way, I agree with you that that is preferable most of the time.
          – David Reed
          11 hours ago














          up vote
          3
          down vote













          While I will recommend to move to Salesforce DX, but in the traditional model of release management, your master should always be a replica of what's in Production.



          A typical flow that I have followed in the past is:





          • Create master as the gold copy. This should be your most recent stable copy of running code in Production. You will need to decide which metadata is important for you to version manage. E.g., if you are only looking to version control Apex, Triggers or you are also looking to version control say Roles, Profiles, etc. My approach to this is that what we build, is version controlled.



            As for how to extract the metadata, you will need to use the Metadata API to extract it from Production and commit it to the repo. You can use Force.com IDE for this purpose. Take a look at this link for details.



          • Create release branch from master. I have usually followed an approach here is to release only what's needed. This is because if you have too many components in the branch (say, copied over from master) which are not modified in the current release, will lead to a longer deployment time. While this depends on the approach if you want to release from master or release branch, but in general, you should only deploy what's required.

          • Developers create feature branches from the release branch, build, test and create PRs to merge to the release branch

          • Release your code from the release branch to Production

          • Merge with master after release


          There can be different ways to handle depending on the scale and choice, but typically this approach has worked well for me.



          You will definitely need to take care of other aspects, viz., code reviews, code merging, etc. but as long as you can put the process in the place, this will work fine.



          This approach also works if your developers are working out of a single sandbox, because every developer will create the feature branch and before it can be merged to the release branch and moved to upper environments, you can implement a review process to make sure the code being committed to the release branch is validated.






          share|improve this answer























          • We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
            – ab0369
            12 hours ago












          • I updated with details in the first bullet in my answer.
            – Jayant Das
            12 hours ago















          up vote
          3
          down vote













          While I will recommend to move to Salesforce DX, but in the traditional model of release management, your master should always be a replica of what's in Production.



          A typical flow that I have followed in the past is:





          • Create master as the gold copy. This should be your most recent stable copy of running code in Production. You will need to decide which metadata is important for you to version manage. E.g., if you are only looking to version control Apex, Triggers or you are also looking to version control say Roles, Profiles, etc. My approach to this is that what we build, is version controlled.



            As for how to extract the metadata, you will need to use the Metadata API to extract it from Production and commit it to the repo. You can use Force.com IDE for this purpose. Take a look at this link for details.



          • Create release branch from master. I have usually followed an approach here is to release only what's needed. This is because if you have too many components in the branch (say, copied over from master) which are not modified in the current release, will lead to a longer deployment time. While this depends on the approach if you want to release from master or release branch, but in general, you should only deploy what's required.

          • Developers create feature branches from the release branch, build, test and create PRs to merge to the release branch

          • Release your code from the release branch to Production

          • Merge with master after release


          There can be different ways to handle depending on the scale and choice, but typically this approach has worked well for me.



          You will definitely need to take care of other aspects, viz., code reviews, code merging, etc. but as long as you can put the process in the place, this will work fine.



          This approach also works if your developers are working out of a single sandbox, because every developer will create the feature branch and before it can be merged to the release branch and moved to upper environments, you can implement a review process to make sure the code being committed to the release branch is validated.






          share|improve this answer























          • We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
            – ab0369
            12 hours ago












          • I updated with details in the first bullet in my answer.
            – Jayant Das
            12 hours ago













          up vote
          3
          down vote










          up vote
          3
          down vote









          While I will recommend to move to Salesforce DX, but in the traditional model of release management, your master should always be a replica of what's in Production.



          A typical flow that I have followed in the past is:





          • Create master as the gold copy. This should be your most recent stable copy of running code in Production. You will need to decide which metadata is important for you to version manage. E.g., if you are only looking to version control Apex, Triggers or you are also looking to version control say Roles, Profiles, etc. My approach to this is that what we build, is version controlled.



            As for how to extract the metadata, you will need to use the Metadata API to extract it from Production and commit it to the repo. You can use Force.com IDE for this purpose. Take a look at this link for details.



          • Create release branch from master. I have usually followed an approach here is to release only what's needed. This is because if you have too many components in the branch (say, copied over from master) which are not modified in the current release, will lead to a longer deployment time. While this depends on the approach if you want to release from master or release branch, but in general, you should only deploy what's required.

          • Developers create feature branches from the release branch, build, test and create PRs to merge to the release branch

          • Release your code from the release branch to Production

          • Merge with master after release


          There can be different ways to handle depending on the scale and choice, but typically this approach has worked well for me.



          You will definitely need to take care of other aspects, viz., code reviews, code merging, etc. but as long as you can put the process in the place, this will work fine.



          This approach also works if your developers are working out of a single sandbox, because every developer will create the feature branch and before it can be merged to the release branch and moved to upper environments, you can implement a review process to make sure the code being committed to the release branch is validated.






          share|improve this answer














          While I will recommend to move to Salesforce DX, but in the traditional model of release management, your master should always be a replica of what's in Production.



          A typical flow that I have followed in the past is:





          • Create master as the gold copy. This should be your most recent stable copy of running code in Production. You will need to decide which metadata is important for you to version manage. E.g., if you are only looking to version control Apex, Triggers or you are also looking to version control say Roles, Profiles, etc. My approach to this is that what we build, is version controlled.



            As for how to extract the metadata, you will need to use the Metadata API to extract it from Production and commit it to the repo. You can use Force.com IDE for this purpose. Take a look at this link for details.



          • Create release branch from master. I have usually followed an approach here is to release only what's needed. This is because if you have too many components in the branch (say, copied over from master) which are not modified in the current release, will lead to a longer deployment time. While this depends on the approach if you want to release from master or release branch, but in general, you should only deploy what's required.

          • Developers create feature branches from the release branch, build, test and create PRs to merge to the release branch

          • Release your code from the release branch to Production

          • Merge with master after release


          There can be different ways to handle depending on the scale and choice, but typically this approach has worked well for me.



          You will definitely need to take care of other aspects, viz., code reviews, code merging, etc. but as long as you can put the process in the place, this will work fine.



          This approach also works if your developers are working out of a single sandbox, because every developer will create the feature branch and before it can be merged to the release branch and moved to upper environments, you can implement a review process to make sure the code being committed to the release branch is validated.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 12 hours ago

























          answered 12 hours ago









          Jayant Das

          11.6k2523




          11.6k2523












          • We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
            – ab0369
            12 hours ago












          • I updated with details in the first bullet in my answer.
            – Jayant Das
            12 hours ago


















          • We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
            – ab0369
            12 hours ago












          • I updated with details in the first bullet in my answer.
            – Jayant Das
            12 hours ago
















          We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
          – ab0369
          12 hours ago






          We are not ready for DX yet. we want to reach there but first we want to setup git based deployments. How to get all the metadata into a master branch since we have limits around time and number for components ?
          – ab0369
          12 hours ago














          I updated with details in the first bullet in my answer.
          – Jayant Das
          12 hours ago




          I updated with details in the first bullet in my answer.
          – Jayant Das
          12 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Salesforce Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242629%2fhow-to-get-all-metadata-into-git-and-what-will-the-optimal-release-flow-using-sa%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei