Skip to content

FireMakeThunder/codecademy-courses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 

Repository files navigation

codecademy-courses

The collection of my Codecademy projects organized by course

How I merged my old repos into this monorepo

I had 7 different repositories on Github for some of the projects I had done for the Codecademy Full Stack Engineer course. Since I was newer with Git, having seperate repos didn't seem too problematic until I realized they made my Github profile look cluttered. So I sought a method to merge these into one repo. Here is how I did it.

These instructions should be called starting at the root of your monorepo directory

  1. Create a temporary folder for the repo to merge into your monorepo

    $ mkdir -p tmp/merging-repo

Use mkdir -p to create all the directories. This is faster than having to call mkdir tmp and then mkdir tmp/merging-repo and is used if you haven't yet created the tmp directory


  1. Clone your repo into the temporary folder

    $ git clone link-to-merging-repo tmp/merging-repo

  1. Move into your temporary folder

    $ cd tmp/merging-repo

  1. Use git-filter-repo to mutate the commits to all apply to a subdirectory

    $ git-filter-repo --to-subdirectory-filter merging-repo

If you haven't before, you will need to install this script.
This script tool will also move all the files in your merging-repo folder into a directory called, in this case, "merging-repo"


  1. Move into your monorepo folder

    $ cd ../../

  1. Add a remote link to your merging repo

    $ git remote add -f merging-repo tmp/merging-repo

-f is the same as calling git fetch merging-repo after this command is entered


  1. Merge your merging repo into your monorepo

    $ git merge --allow-unrelated-histories merging-repo/main

If your monorepo already has a commit history, then --allow-unrelated-histories will likely be required


  1. Clean up
    \
  $ git remote rm merging-repo
  $ rm -rf tmp

About

The collection of my Codecademy projects organized by course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published