Efficiently merge handle parallel feature branches in SFDX












10















Imagine a team of 5 developers using DX scratch orgs (using Salesforce' Falcon Template) for working on multiple features in parallel.



They start from a clean packaging org and a clean Git master. Every developer creates a feature branch for her user story and works on it.




  • When do they commit and push?

  • When do they pull?

  • When do they recreate their scratch orgs?


Those are not scratch org questions or on how to version in general. It's about keeping developers in sync and prevent a big merging orgy when everybody is done.




  1. Should everybody pull and recreate and merge as soon as one story is
    done and merged?

  2. How would that look?

  3. Is the recommended approach documented anywhere?










share|improve this question



























    10















    Imagine a team of 5 developers using DX scratch orgs (using Salesforce' Falcon Template) for working on multiple features in parallel.



    They start from a clean packaging org and a clean Git master. Every developer creates a feature branch for her user story and works on it.




    • When do they commit and push?

    • When do they pull?

    • When do they recreate their scratch orgs?


    Those are not scratch org questions or on how to version in general. It's about keeping developers in sync and prevent a big merging orgy when everybody is done.




    1. Should everybody pull and recreate and merge as soon as one story is
      done and merged?

    2. How would that look?

    3. Is the recommended approach documented anywhere?










    share|improve this question

























      10












      10








      10


      4






      Imagine a team of 5 developers using DX scratch orgs (using Salesforce' Falcon Template) for working on multiple features in parallel.



      They start from a clean packaging org and a clean Git master. Every developer creates a feature branch for her user story and works on it.




      • When do they commit and push?

      • When do they pull?

      • When do they recreate their scratch orgs?


      Those are not scratch org questions or on how to version in general. It's about keeping developers in sync and prevent a big merging orgy when everybody is done.




      1. Should everybody pull and recreate and merge as soon as one story is
        done and merged?

      2. How would that look?

      3. Is the recommended approach documented anywhere?










      share|improve this question














      Imagine a team of 5 developers using DX scratch orgs (using Salesforce' Falcon Template) for working on multiple features in parallel.



      They start from a clean packaging org and a clean Git master. Every developer creates a feature branch for her user story and works on it.




      • When do they commit and push?

      • When do they pull?

      • When do they recreate their scratch orgs?


      Those are not scratch org questions or on how to version in general. It's about keeping developers in sync and prevent a big merging orgy when everybody is done.




      1. Should everybody pull and recreate and merge as soon as one story is
        done and merged?

      2. How would that look?

      3. Is the recommended approach documented anywhere?







      salesforcedx versioning version-control ci feature-management






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Robert SösemannRobert Sösemann

      13.1k1178224




      13.1k1178224






















          3 Answers
          3






          active

          oldest

          votes


















          4














          I'm going to have to answer the questions out of order for them to make sense, and much of this is anecdotal at this point, but we've been doing this for a couple of years now, so I hope that this answer will be useful.




          Is the recommended approach documented anywhere?




          There are several competing theories on which way is the "best," and it's not related just to Salesforce, but any team that deals with git or another version control system. Salesforce only recommends that we use git, but doesn't prescribe a specific pattern, as far as I'm aware.




          Should everybody pull and recreate and merge as soon as one story is done and merged?




          Depending on the cadence of the team, this is more likely to be disruptive than helpful. There's a fairly simple way to handle this situation, which I'll outline below.




          When do they recreate their scratch orgs?




          Whenever they feel like it. You can do this one per story, once per feature, every time it expires, etc. Assuming all of the code is in your source of truth, it shouldn't matter.




          When do they commit and push?




          Commit periodically to have "backups" in case things go wrong, and push (preferably with a "squash") when it's ready to move on to the next branch.




          When do they pull?




          Immediately before branching or merging.




          How would that look?




          After a lot of painful experiences, we've come up with this process in general. Starting from the point where there's a new story to be implemented...



          The repo should be organized with a master branch, a staging and/or test branch (for deployment to a master testing sandbox), and one branch per story or feature. Start by going to the "dev" branch, whatever that means for your org, pull to make sure you have the latest copy, then create a new branch to work in.



          Developers then push the current state of affairs to a Scratch Org, and begin development using their preferred method. Periodically commit so you can fix mistakes if they happen or if your org expires, etc.



          Once the story is complete, go back to the "dev" branch, pull again, switch back to the story branch, and merge the dev branch in to the story branch. This brings it up to date and will let you know of any merge conflicts.



          Resolve any conflicts, commit again, and then merge/pull request back in to the dev branch. At this point, the dev branch should be good for testing and deployment. Finally, when deploying to production, a similar pull, merge, resolve conflicts (which ideally should not happen), and merge again cycle should happen.



          Once everything is fully merged to production, you can delete the story branches to save space and optimize performance.






          share|improve this answer































            5














            There are numerous strategies for doing so (So, there is no 1 good answer), however, here are a few resources that can help answers some if not all those questions based on your needs:



            GitFlow Examples




            These examples are using the default configuration with GitVersion. Which is continuous deployment mode for develop and continuous delivery mode for all other branches.




            Feature Branches:



            enter image description here



            GitHub Flow a nutshell:




            1. Update master to latest upstream code

            2. Create a feature branch git checkout -b myFeatureBranch

            3. Do the feature/work (Spawn Scratch Orgs to develop/test features)

            4. Push feature branch to origin

            5. Create pull request from origin/ -> upstream/master

            6. Review, fix raised comments, merge your PR or even better, get someone else to.



            The main rule of GitHub Flow is that master should always be
            deployable. GitHub Flow allows and encourages continuous delivery.




            For a more verbose description of each step, you can refer to Understanding the GitHub flow






            share|improve this answer































              2














              Our currently workflow:




              • git checkout -b feature/sales-api

              • git commit add .

              • git commit -am ""

              • git fetch origin

              • git rebase origin master


              Once is done, rebase your branch to get the newest version of master, then:




              • sfdx package:version:create....


              Actually we have more than one package in a project. Particularly, I don't like this approach, because if I have only one package by repository we could automate everything.
              Eg. after commit on develop/ build a version and install in the UAT.
              after commit on master/ build a new version/ update the release doc and install in production.



              (Currently we have 35 packages)






              share|improve this answer


























                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',
                autoActivateHeartbeat: false,
                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%2f255333%2fefficiently-merge-handle-parallel-feature-branches-in-sfdx%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                4














                I'm going to have to answer the questions out of order for them to make sense, and much of this is anecdotal at this point, but we've been doing this for a couple of years now, so I hope that this answer will be useful.




                Is the recommended approach documented anywhere?




                There are several competing theories on which way is the "best," and it's not related just to Salesforce, but any team that deals with git or another version control system. Salesforce only recommends that we use git, but doesn't prescribe a specific pattern, as far as I'm aware.




                Should everybody pull and recreate and merge as soon as one story is done and merged?




                Depending on the cadence of the team, this is more likely to be disruptive than helpful. There's a fairly simple way to handle this situation, which I'll outline below.




                When do they recreate their scratch orgs?




                Whenever they feel like it. You can do this one per story, once per feature, every time it expires, etc. Assuming all of the code is in your source of truth, it shouldn't matter.




                When do they commit and push?




                Commit periodically to have "backups" in case things go wrong, and push (preferably with a "squash") when it's ready to move on to the next branch.




                When do they pull?




                Immediately before branching or merging.




                How would that look?




                After a lot of painful experiences, we've come up with this process in general. Starting from the point where there's a new story to be implemented...



                The repo should be organized with a master branch, a staging and/or test branch (for deployment to a master testing sandbox), and one branch per story or feature. Start by going to the "dev" branch, whatever that means for your org, pull to make sure you have the latest copy, then create a new branch to work in.



                Developers then push the current state of affairs to a Scratch Org, and begin development using their preferred method. Periodically commit so you can fix mistakes if they happen or if your org expires, etc.



                Once the story is complete, go back to the "dev" branch, pull again, switch back to the story branch, and merge the dev branch in to the story branch. This brings it up to date and will let you know of any merge conflicts.



                Resolve any conflicts, commit again, and then merge/pull request back in to the dev branch. At this point, the dev branch should be good for testing and deployment. Finally, when deploying to production, a similar pull, merge, resolve conflicts (which ideally should not happen), and merge again cycle should happen.



                Once everything is fully merged to production, you can delete the story branches to save space and optimize performance.






                share|improve this answer




























                  4














                  I'm going to have to answer the questions out of order for them to make sense, and much of this is anecdotal at this point, but we've been doing this for a couple of years now, so I hope that this answer will be useful.




                  Is the recommended approach documented anywhere?




                  There are several competing theories on which way is the "best," and it's not related just to Salesforce, but any team that deals with git or another version control system. Salesforce only recommends that we use git, but doesn't prescribe a specific pattern, as far as I'm aware.




                  Should everybody pull and recreate and merge as soon as one story is done and merged?




                  Depending on the cadence of the team, this is more likely to be disruptive than helpful. There's a fairly simple way to handle this situation, which I'll outline below.




                  When do they recreate their scratch orgs?




                  Whenever they feel like it. You can do this one per story, once per feature, every time it expires, etc. Assuming all of the code is in your source of truth, it shouldn't matter.




                  When do they commit and push?




                  Commit periodically to have "backups" in case things go wrong, and push (preferably with a "squash") when it's ready to move on to the next branch.




                  When do they pull?




                  Immediately before branching or merging.




                  How would that look?




                  After a lot of painful experiences, we've come up with this process in general. Starting from the point where there's a new story to be implemented...



                  The repo should be organized with a master branch, a staging and/or test branch (for deployment to a master testing sandbox), and one branch per story or feature. Start by going to the "dev" branch, whatever that means for your org, pull to make sure you have the latest copy, then create a new branch to work in.



                  Developers then push the current state of affairs to a Scratch Org, and begin development using their preferred method. Periodically commit so you can fix mistakes if they happen or if your org expires, etc.



                  Once the story is complete, go back to the "dev" branch, pull again, switch back to the story branch, and merge the dev branch in to the story branch. This brings it up to date and will let you know of any merge conflicts.



                  Resolve any conflicts, commit again, and then merge/pull request back in to the dev branch. At this point, the dev branch should be good for testing and deployment. Finally, when deploying to production, a similar pull, merge, resolve conflicts (which ideally should not happen), and merge again cycle should happen.



                  Once everything is fully merged to production, you can delete the story branches to save space and optimize performance.






                  share|improve this answer


























                    4












                    4








                    4







                    I'm going to have to answer the questions out of order for them to make sense, and much of this is anecdotal at this point, but we've been doing this for a couple of years now, so I hope that this answer will be useful.




                    Is the recommended approach documented anywhere?




                    There are several competing theories on which way is the "best," and it's not related just to Salesforce, but any team that deals with git or another version control system. Salesforce only recommends that we use git, but doesn't prescribe a specific pattern, as far as I'm aware.




                    Should everybody pull and recreate and merge as soon as one story is done and merged?




                    Depending on the cadence of the team, this is more likely to be disruptive than helpful. There's a fairly simple way to handle this situation, which I'll outline below.




                    When do they recreate their scratch orgs?




                    Whenever they feel like it. You can do this one per story, once per feature, every time it expires, etc. Assuming all of the code is in your source of truth, it shouldn't matter.




                    When do they commit and push?




                    Commit periodically to have "backups" in case things go wrong, and push (preferably with a "squash") when it's ready to move on to the next branch.




                    When do they pull?




                    Immediately before branching or merging.




                    How would that look?




                    After a lot of painful experiences, we've come up with this process in general. Starting from the point where there's a new story to be implemented...



                    The repo should be organized with a master branch, a staging and/or test branch (for deployment to a master testing sandbox), and one branch per story or feature. Start by going to the "dev" branch, whatever that means for your org, pull to make sure you have the latest copy, then create a new branch to work in.



                    Developers then push the current state of affairs to a Scratch Org, and begin development using their preferred method. Periodically commit so you can fix mistakes if they happen or if your org expires, etc.



                    Once the story is complete, go back to the "dev" branch, pull again, switch back to the story branch, and merge the dev branch in to the story branch. This brings it up to date and will let you know of any merge conflicts.



                    Resolve any conflicts, commit again, and then merge/pull request back in to the dev branch. At this point, the dev branch should be good for testing and deployment. Finally, when deploying to production, a similar pull, merge, resolve conflicts (which ideally should not happen), and merge again cycle should happen.



                    Once everything is fully merged to production, you can delete the story branches to save space and optimize performance.






                    share|improve this answer













                    I'm going to have to answer the questions out of order for them to make sense, and much of this is anecdotal at this point, but we've been doing this for a couple of years now, so I hope that this answer will be useful.




                    Is the recommended approach documented anywhere?




                    There are several competing theories on which way is the "best," and it's not related just to Salesforce, but any team that deals with git or another version control system. Salesforce only recommends that we use git, but doesn't prescribe a specific pattern, as far as I'm aware.




                    Should everybody pull and recreate and merge as soon as one story is done and merged?




                    Depending on the cadence of the team, this is more likely to be disruptive than helpful. There's a fairly simple way to handle this situation, which I'll outline below.




                    When do they recreate their scratch orgs?




                    Whenever they feel like it. You can do this one per story, once per feature, every time it expires, etc. Assuming all of the code is in your source of truth, it shouldn't matter.




                    When do they commit and push?




                    Commit periodically to have "backups" in case things go wrong, and push (preferably with a "squash") when it's ready to move on to the next branch.




                    When do they pull?




                    Immediately before branching or merging.




                    How would that look?




                    After a lot of painful experiences, we've come up with this process in general. Starting from the point where there's a new story to be implemented...



                    The repo should be organized with a master branch, a staging and/or test branch (for deployment to a master testing sandbox), and one branch per story or feature. Start by going to the "dev" branch, whatever that means for your org, pull to make sure you have the latest copy, then create a new branch to work in.



                    Developers then push the current state of affairs to a Scratch Org, and begin development using their preferred method. Periodically commit so you can fix mistakes if they happen or if your org expires, etc.



                    Once the story is complete, go back to the "dev" branch, pull again, switch back to the story branch, and merge the dev branch in to the story branch. This brings it up to date and will let you know of any merge conflicts.



                    Resolve any conflicts, commit again, and then merge/pull request back in to the dev branch. At this point, the dev branch should be good for testing and deployment. Finally, when deploying to production, a similar pull, merge, resolve conflicts (which ideally should not happen), and merge again cycle should happen.



                    Once everything is fully merged to production, you can delete the story branches to save space and optimize performance.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 2 days ago









                    sfdcfoxsfdcfox

                    262k12209453




                    262k12209453

























                        5














                        There are numerous strategies for doing so (So, there is no 1 good answer), however, here are a few resources that can help answers some if not all those questions based on your needs:



                        GitFlow Examples




                        These examples are using the default configuration with GitVersion. Which is continuous deployment mode for develop and continuous delivery mode for all other branches.




                        Feature Branches:



                        enter image description here



                        GitHub Flow a nutshell:




                        1. Update master to latest upstream code

                        2. Create a feature branch git checkout -b myFeatureBranch

                        3. Do the feature/work (Spawn Scratch Orgs to develop/test features)

                        4. Push feature branch to origin

                        5. Create pull request from origin/ -> upstream/master

                        6. Review, fix raised comments, merge your PR or even better, get someone else to.



                        The main rule of GitHub Flow is that master should always be
                        deployable. GitHub Flow allows and encourages continuous delivery.




                        For a more verbose description of each step, you can refer to Understanding the GitHub flow






                        share|improve this answer




























                          5














                          There are numerous strategies for doing so (So, there is no 1 good answer), however, here are a few resources that can help answers some if not all those questions based on your needs:



                          GitFlow Examples




                          These examples are using the default configuration with GitVersion. Which is continuous deployment mode for develop and continuous delivery mode for all other branches.




                          Feature Branches:



                          enter image description here



                          GitHub Flow a nutshell:




                          1. Update master to latest upstream code

                          2. Create a feature branch git checkout -b myFeatureBranch

                          3. Do the feature/work (Spawn Scratch Orgs to develop/test features)

                          4. Push feature branch to origin

                          5. Create pull request from origin/ -> upstream/master

                          6. Review, fix raised comments, merge your PR or even better, get someone else to.



                          The main rule of GitHub Flow is that master should always be
                          deployable. GitHub Flow allows and encourages continuous delivery.




                          For a more verbose description of each step, you can refer to Understanding the GitHub flow






                          share|improve this answer


























                            5












                            5








                            5







                            There are numerous strategies for doing so (So, there is no 1 good answer), however, here are a few resources that can help answers some if not all those questions based on your needs:



                            GitFlow Examples




                            These examples are using the default configuration with GitVersion. Which is continuous deployment mode for develop and continuous delivery mode for all other branches.




                            Feature Branches:



                            enter image description here



                            GitHub Flow a nutshell:




                            1. Update master to latest upstream code

                            2. Create a feature branch git checkout -b myFeatureBranch

                            3. Do the feature/work (Spawn Scratch Orgs to develop/test features)

                            4. Push feature branch to origin

                            5. Create pull request from origin/ -> upstream/master

                            6. Review, fix raised comments, merge your PR or even better, get someone else to.



                            The main rule of GitHub Flow is that master should always be
                            deployable. GitHub Flow allows and encourages continuous delivery.




                            For a more verbose description of each step, you can refer to Understanding the GitHub flow






                            share|improve this answer













                            There are numerous strategies for doing so (So, there is no 1 good answer), however, here are a few resources that can help answers some if not all those questions based on your needs:



                            GitFlow Examples




                            These examples are using the default configuration with GitVersion. Which is continuous deployment mode for develop and continuous delivery mode for all other branches.




                            Feature Branches:



                            enter image description here



                            GitHub Flow a nutshell:




                            1. Update master to latest upstream code

                            2. Create a feature branch git checkout -b myFeatureBranch

                            3. Do the feature/work (Spawn Scratch Orgs to develop/test features)

                            4. Push feature branch to origin

                            5. Create pull request from origin/ -> upstream/master

                            6. Review, fix raised comments, merge your PR or even better, get someone else to.



                            The main rule of GitHub Flow is that master should always be
                            deployable. GitHub Flow allows and encourages continuous delivery.




                            For a more verbose description of each step, you can refer to Understanding the GitHub flow







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 2 days ago









                            gllsglls

                            11.5k72252




                            11.5k72252























                                2














                                Our currently workflow:




                                • git checkout -b feature/sales-api

                                • git commit add .

                                • git commit -am ""

                                • git fetch origin

                                • git rebase origin master


                                Once is done, rebase your branch to get the newest version of master, then:




                                • sfdx package:version:create....


                                Actually we have more than one package in a project. Particularly, I don't like this approach, because if I have only one package by repository we could automate everything.
                                Eg. after commit on develop/ build a version and install in the UAT.
                                after commit on master/ build a new version/ update the release doc and install in production.



                                (Currently we have 35 packages)






                                share|improve this answer






























                                  2














                                  Our currently workflow:




                                  • git checkout -b feature/sales-api

                                  • git commit add .

                                  • git commit -am ""

                                  • git fetch origin

                                  • git rebase origin master


                                  Once is done, rebase your branch to get the newest version of master, then:




                                  • sfdx package:version:create....


                                  Actually we have more than one package in a project. Particularly, I don't like this approach, because if I have only one package by repository we could automate everything.
                                  Eg. after commit on develop/ build a version and install in the UAT.
                                  after commit on master/ build a new version/ update the release doc and install in production.



                                  (Currently we have 35 packages)






                                  share|improve this answer




























                                    2












                                    2








                                    2







                                    Our currently workflow:




                                    • git checkout -b feature/sales-api

                                    • git commit add .

                                    • git commit -am ""

                                    • git fetch origin

                                    • git rebase origin master


                                    Once is done, rebase your branch to get the newest version of master, then:




                                    • sfdx package:version:create....


                                    Actually we have more than one package in a project. Particularly, I don't like this approach, because if I have only one package by repository we could automate everything.
                                    Eg. after commit on develop/ build a version and install in the UAT.
                                    after commit on master/ build a new version/ update the release doc and install in production.



                                    (Currently we have 35 packages)






                                    share|improve this answer















                                    Our currently workflow:




                                    • git checkout -b feature/sales-api

                                    • git commit add .

                                    • git commit -am ""

                                    • git fetch origin

                                    • git rebase origin master


                                    Once is done, rebase your branch to get the newest version of master, then:




                                    • sfdx package:version:create....


                                    Actually we have more than one package in a project. Particularly, I don't like this approach, because if I have only one package by repository we could automate everything.
                                    Eg. after commit on develop/ build a version and install in the UAT.
                                    after commit on master/ build a new version/ update the release doc and install in production.



                                    (Currently we have 35 packages)







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 2 days ago









                                    Raul

                                    11.9k31841




                                    11.9k31841










                                    answered 2 days ago









                                    Diéffrei QuadrosDiéffrei Quadros

                                    211




                                    211






























                                        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.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f255333%2fefficiently-merge-handle-parallel-feature-branches-in-sfdx%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

                                        數位音樂下載

                                        When can things happen in Etherscan, such as the picture below?

                                        格利澤436b