hypnagaga/.github/prompts/plan-graphicsComponentsSrc.prompt.md

1.3 KiB

Plan: Convert Submodule to Git Subtree for graphics-components-src

1. Remove the submodule (if present)

  • Remove the submodule and its config:
    git submodule deinit -f graphics-components-src
    git rm -f graphics-components-src
    rm -rf .gitmodules
    

2. Add the upstream repo as a remote (if not already)

  • Add the original repo as a remote:
    git remote add upstreamRepo https://github.com/reuters-graphics/graphics-components.git
    git fetch upstreamRepo
    

3. Add the code as a subtree

  • Import the code into your repo:
    git subtree add --prefix=graphics-components-src upstreamRepo main --squash
    
    • Replace main with the correct branch name if needed.

4. Make your own changes

  • Edit files in graphics-components-src as needed.
  • Commit your changes as normal.

5. Pull in upstream changes later

  • When you want to update from upstream:
    git fetch upstreamRepo
    git subtree pull --prefix=graphics-components-src upstreamRepo main --squash
    
    • Resolve any conflicts and commit.

6. Push your repo as normal

  • All code (including the subtree) is in your repo.
  • Push as usual:
    git push
    

Summary:

  • Use git subtree add to import the code.
  • Use git subtree pull to update from upstream.
  • Make and commit your own changes as usual.