Answers.Body: <p>I don't quite understand your situation – why is part of your team working on parts of the app that are in the process of being upgraded? Aren't you duplicating work there? It makes no sense to work on a component that is currently being upgraded and requires changes to work with the new version. Wouldn't it be easier to declare a feature-freeze and have <em>everyone</em> participate in upgrading to the new version, update their components and tests and be done with it much quicker?</p>
  <hr />
  <p>If you really <em>need</em> to continue working on new features while you're in the process of upgrading the app, you're gonna want to do the upgrade in a separate branch. You won't find a perfect solution to keep two diverging branches of the same app and then merge them magically at the end. Instead, you want to avoid a huge merge conflict in the end. Instead, try to keep the two branches in sync by <em>merging regularly</em>.</p>
  <p>Let's say you have two branches, <code>main</code> (the current version of the app) and <code>upgrade</code> (the react 17 version with the new testing library). If new features are developed on <code>main</code> (I hope you're using feature branches and PRs to get new features out), you want to merge the <code>main</code> branch into the <code>upgrade</code> branch regularly. For example, merge the <code>main</code> branch into <code>upgrade</code> once a day and fix any merge conflicts right then and there. This ensures your branches aren't getting out of sync. Once the <code>upgrade</code> branch is ready to replace the old version of the app, merge it into <code>main</code> and delete the <code>upgrade</code> branch. Now everyone can continue working without a huge disruption while someone fixes hundreds of merge conflicts.</p>
  <p>If you're getting tons of complicated merge conflicts during the daily merges, this is a strong sign that you're duplicating efforts. One person working on a new feature in the old version that will immediately require updates in the new version doesn't make sense. But if you for some reason can't avoid this, minimizing the pain by merging regularly and doing the leg-work of fixing any conflicts right there is the way to go.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-17T10:01:04.263Z
Answers.LastActivityDate: 2021-12-17T10:01:04.263Z
Answers.UserDisplayName: MoritzLost
Body: <p>Currently on my project, we are updating to react 17 and the testing library we use(enzyme to react testing library). In this process will we need to update multiple tests and files. However I don't want to do the upgrade in our main branch.</p>
  <p>If I create a new branch that our team works off of - we won't be able to keep it updated with our main branch’s code(which we will continue to work on). That is not a viable solution, since that will lead to multiple merge conflicts and issues.</p>
  <p>Another option is to update react/testing library on our main branch and ignore tests/files we need to get the app to work and build to pass. Then just work off of our main branch and update the code.</p>
  <p>Ideally I would like:</p>
  <ul>
  <li>A separate branch that devs can merge into with upgrades</li>
  <li>The separate branch to be able to stay up to date with develop</li>
  <li>Merge branch when all work is complete</li>
  <li>Ability to work off main branch without upgrades</li>
  </ul>
  <p>From my understanding there is no standard way of doing this. I looked into <code>git worktree</code> and not sure if that does what I need. Any recommendations on the best way of accomplishing this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-17T10:21:08.647Z
Comments.Text: I’m voting to close this question because it's nothing to do with Craft
Comments.UserDisplayName: James Smith
Tags: <git>
Title: Git workflow and upgrading application
ThreadText: # Git workflow and upgrading application
  
  (Asked by: username_0 on 2021-12-16)
  
  Currently on my project, we are updating to react 17 and the testing library we use(enzyme to react testing library). In this process will we need to update multiple tests and files. However I don't want to do the upgrade in our main branch.
  
  If I create a new branch that our team works off of - we won't be able to keep it updated with our main branch’s code(which we will continue to work on). That is not a viable solution, since that will lead to multiple merge conflicts and issues.
  
  Another option is to update react/testing library on our main branch and ignore tests/files we need to get the app to work and build to pass. Then just work off of our main branch and update the code.
  
  Ideally I would like:
  
  * A separate branch that devs can merge into with upgrades
  * The separate branch to be able to stay up to date with develop
  * Merge branch when all work is complete
  * Ability to work off main branch without upgrades
  
  From my understanding there is no standard way of doing this. I looked into `git worktree` and not sure if that does what I need. Any recommendations on the best way of accomplishing this?
  
  **Tags:** git
  
  > **Comments:**
  > **username_1**: I’m voting to close this question because it's nothing to do with Craft  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-12-17. Score: 1
  
  I don't quite understand your situation – why is part of your team working on parts of the app that are in the process of being upgraded? Aren't you duplicating work there? It makes no sense to work on a component that is currently being upgraded and requires changes to work with the new version. Wouldn't it be easier to declare a feature-freeze and have *everyone* participate in upgrading to the new version, update their components and tests and be done with it much quicker?
  
  ---
  
  If you really *need* to continue working on new features while you're in the process of upgrading the app, you're gonna want to do the upgrade in a separate branch. You won't find a perfect solution to keep two diverging branches of the same app and then merge them magically at the end. Instead, you want to avoid a huge merge conflict in the end. Instead, try to keep the two branches in sync by *merging regularly*.
  
  Let's say you have two branches, `main` (the current version of the app) and `upgrade` (the react 17 version with the new testing library). If new features are developed on `main` (I hope you're using feature branches and PRs to get new features out), you want to merge the `main` branch into the `upgrade` branch regularly. For example, merge the `main` branch into `upgrade` once a day and fix any merge conflicts right then and there. This ensures your branches aren't getting out of sync. Once the `upgrade` branch is ready to replace the old version of the app, merge it into `main` and delete the `upgrade` branch. Now everyone can continue working without a huge disruption while someone fixes hundreds of merge conflicts.
  
  If you're getting tons of complicated merge conflicts during the daily merges, this is a strong sign that you're duplicating efforts. One person working on a new feature in the old version that will immediately require updates in the new version doesn't make sense. But if you for some reason can't avoid this, minimizing the pain by merging regularly and doing the leg-work of fixing any conflicts right there is the way to go.
  
  
  ---
  
  