You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directory is to store my various repositories for notes on specific programs, topics, software, or languages.
Adding Repos to This
To add already started repos to this directory, make sure the repos are not inside this directory to start.
Run git remote add <temp-name> <path to repo being added> This adds an entry for <temp-name> to the .git/config of this repo so there will be references to the commits we are about to add. <temp-name> is just a temporary name to be used for the repo you are trying to add so we can copy info from it.
Run git fetch <temp-name> main this will copy the commit info from the source repo into the .git/objects of this repo for the main branch of the source repo (assuming its named main). This is needed for the next step.
git subtree add --prefix=<local-name> <temp-name>/main this takes the git history of the main branch you copied in the prior step and performs a merge like operation to combine the commit history with this repo's commit history. This is stored under the prefix defined by <local-name> and a new directory is also created to store the repo locally here.
You can check the repo was imported by running git log --oneline -- <local-name> which will give a message telling you a repo was added from a previous commit. Take that commit number and run: git log --oneline --decorate --graph <commit number> to see the imported history and check it.
Repeat these steps for each repo you want to add
Recommend running git remote remove <temp-name> when done to keep the remote entries clean so there is just origin later. Still keeps all the history imported.