azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

Add Merge-Main.ps1 script

Open hallipr opened this issue 3 years ago • 0 comments

Add script for merging main into the long-lived spring feature branches.

Given a feature/spring branch like:

eng/
    drift.ps1
    versioning/
        external_dependencies.txt  (with changes)
        drift.txt
sdk/
    not-spring/
         pom.xml
         drift.md
    spring/
         pom.xml
         v3.txt

And a main branch like:

eng/
    versioning/
        external_dependencies.txt  (with conflicting changes)
sdk/
    not-spring/
         pom.xml
    something-new/
         pom.xml
    spring/
         pom.xml
         v2.txt

After running Merge-Main.ps1, we would expect an in-progress merge commit like:

Changes to be committed:
        deleted:    eng/drift.ps1
        deleted:    eng/versioning/drift.txt
        deleted:    sdk/not-spring/drift.md
        modified:   sdk/not-spring/pom.xml
        new file:   sdk/something-new/pom.xml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   eng/versioning/external_dependencies.txt

The net effect being:

  • the sdk/spring folder remained untouched even though it differs from main.
  • txt files in eng/versioning are merged from main
  • except for sdk/spring, any file not in main is deleted from the current branch
  • all other files are copied from main, overwriting the current branch
  • the merge is waiting for remaining conflicts to be manually resolved

hallipr avatar Aug 27 '22 08:08 hallipr