Class 3 - Assignment
Instead of following the assignment strictly, I went on two personal endeavours with Git / GitHub. The first was simple. Made a PR into someone else’s github! Turns out there’s an invite to accept someone as a contributor. You must accept too to be able to push.

Endeavour #2: Repository mixing through git subtree add
Before
thesis-prototype [not a git repo yet]
|
--- esp32-proto2-sd/ [git repo w/ commits I want to preserve]
--- esp32-proto3-xiao/ [ not a git repo - want to start keeping track on GitHub ]
--- [ many other folders ] I have been pushing to a Git repo + remote repo under one folder specific to an Adafruit ESP board and now I’m developing in paralell another code for a different board. Because it’s the same project, creating a 2nd repo feels like duplication. And I very much want to preserve my commit history so I can look back on the evolution (and the GitHub contributions chart 🤠).
Adding sub-divisions under my existing esp32-proto2-sd/ folder is not an option because that means I’d lose my current Claude Code conversations which get retrieved based on pwd (printed working directory).
Therefore, the repo needs to sit upstream in my file structure. The simple solution is to create a new repo of thesis_prototype and .gitignore everything that's not these two folders, but I’d lose commit history of the different features.
Solution: git subtree add
- Init a new repo at thesis_prototype/
- git subtree add the existing esp32-proto2-sd repo. This replays every commit with paths rewritten under the esp32-proto2-sd/ subdirectory.
- Add esp32-proto3-xiao as usual
- Push to a new GitHub repo
PS: Eventually, when and if I open source, having two repos for people with different boards could make sense —- but I suppose it’s heavily dependent on where the community exists + how we want to centralize it [~marketing~].

In my new git repository, created a subtree adding previous repo.

Got an error saying that the folder/prefix already exists on disk, so git subtree can't create it. Need to temporarily move it out of the way.

Clean up the temp folder.



Pushing to GitHub

Main goal achieved: commit history is preserved in this new repository


Archiving old repo
To avoiding mistakenly pushing to the old one out of habit, it’s best to archive the repo, making it read-only.


Checking if the remote has been removed and if the other (new) sub-folder behaves the same.

As a final sanity check, you can use git remote -v to see which remote repository you’re pushing to.

Seems like from now on, future commits in esp32-proto2-sd/ should be made from the parent thesis_prototype/ repo now, not from inside the subfolder's old .git, as a precaution. I’d like to understand this better. What do precautions and superstitions look like in computing?
What I don’t fully understand is why these folders (which are in my gitignore file without a doubt) show up here as untracked.

First check is whether .gitignore file is at the correct level. It was, despite being hidden through ls.
The issue was the indentation on the .gitignore file itself. Once I fixed it, those folders no longer appear as options for tracking.
