cc-archive / vocabulary-legacy

A cohesive design system & Vue component library to unify the web-facing Creative Commons
https://cc-vocabulary.netlify.app
MIT License
88 stars 129 forks source link

Reintegration example: src/scss/header.scss #1083

Closed TimidRobot closed 2 years ago

TimidRobot commented 2 years ago

Description

Goal: merge deleted file with full history with copy in the creativecommons/vocabulary-styles repo (which did not include full history 🤦🏻 ):

  1. creativecommons/vocabulary: eb60730128 packages/vocabulary/src/styles/header.scss (last commit before it was deleted)
  2. creativecommons/vocabulary-styles: 7ad97a943d src/styles/header.scss (current commit when this issues was created)

Process

  1. Clone creativecommons/vocabulary (this repository)
    • Perform any needed configuration (ex. GnuPG signing)
  2. Checkout branch at last commit for packages/vocabulary/src/styles/header.scss prior to deletion
    git checkout eb60730128 -b temp-eb60730128
  3. Prepare cherry-pick directory:
    mkdir -p src/styles
  4. Move file into cherry-pick directory:
    git mv packages/vocabulary/src/styles/header.scss src/styles/header.scss
    git commit -m'move file into cherry-pick directory'
  5. Save commit reference
    SAVED=$(git rev-parse HEAD)
  6. Create working/destination branch
    git checkout -b reintegration-example main
  7. Merge restored file in cherry-pick directory
    git merge ${SAVED}
    • (this will give a CONFLICT warning)
      git add src/styles/header.scss
      git commit -m'restore file'
  8. Add creativecommons/vocabulary-styles as a remote and update branches
    git remote add vocabulary-styles https://github.com/creativecommons/vocabulary-styles.git
    git remote update
  9. Cherry-pick all commits creativecommons/vocabulary-styles: 7ad97a943d src/styles/header.scss since that repository was created:
    git cherry-pick -Xtheirs ca73e9b411f8d187cd10468b340615606b0dd8a6
    git cherry-pick -Xtheirs 6d2b73a320972822a126790a1f18502c9e751bee
    git cherry-pick -Xtheirs fdfc5486b972621fb9c060af78992c31eb7ad991
    git cherry-pick -Xtheirs f385e0e57de81074405fa87ec0279f8feaf86a67
  10. Create final destination for file
    mkdir -p src/scss
  11. Move file into final destination
    git mv src/styles/header.scss src/scss/header.scss
    git commit -m'move file to final destination'
  12. Verify history:

    git log --follow src/scss/header.scss
    commit 96c7de92340cad65987e6285a3c9e12ced89d589 (HEAD -> reintegration-example)
    Author: Timid Robot Zehta <timid@creativecommons.org>
    Date:   2022-09-22 09:55:54 -0700
    
        move file to final destination
    
    commit d4384730527cfaae98182efdac97d6019cf44988
    Author: Brylie Christopher Oxley <brylie@creativecommons.org>
    Date:   2022-03-04 14:27:30 +0200
    
        Remove mobile() and tablet()
    
    commit 2857737578cef33fdb8a319f80655e84966a3537
    Author: Brylie Christopher Oxley <brylie@creativecommons.org>
    Date:   2022-03-04 14:08:34 +0200
    
        Set .navbar-brand margin-left to auto
    
    commit 174fac55aa84cf95171dcc76c8f9eb3281281f55
    Author: Brylie Christopher Oxley <brylie@creativecommons.org>
    Date:   2022-03-04 13:32:21 +0200
    
        Remove breakpoint-specific overrides
    
    commit 184865e4f7f8c52e4c2d46374281cc506cefa2db
    Author: Brylie Christopher Oxley <brylie@creativecommons.org>
    Date:   2022-03-04 13:29:07 +0200
    
        Remove breakpoint override
    
    commit 6e49449880c90f236c512ce0be935834968adf1b (temp-eb60730128)
    Author: Timid Robot Zehta <timid@creativecommons.org>
    Date:   2022-09-22 09:53:42 -0700
    
        move file into cherry-pick directory
    
    commit 897907c94163be0140843fd6650d360ca028f1ea
    Author: Dhruv Bhanushali <dhruv_b@live.com>
    Date:   2021-07-18 17:53:29 +0530
    
        Relocate SCSS stylesheets
    
    commit fdd70e3f3e3144281871722fd6f2b0f68d17b95f
    Author: Zack Krida <zackkrida@pm.me>
    Date:   2020-11-20 07:44:23 -1000
    
        Remove fullhd top padding
    
    [...]
  13. Clean-up temp branch
    git branch -D temp-eb60730128

Result

git cherry-pick -Xtheirs

The -Xtheirs option forces conflicting hunks to be auto-resolved cleanly by favoring their version. Changes from our tree that do not conflict with their side are reflected in the merge result. (Adapted from Git - git-merge Documentation)

Viewing full history of a deleted file

git log --all --full-history -- packages/vocabulary/src/styles/header.scss

Related Links