Git without the Hub
I use Git for pretty much everything I start. GitHub, though, not so much. If I’m working with a group, it can be very helpful, but for solo work I find it unnecessary.
I use solo projects to try out new things. There are only a few Git features that I need for them:
- Atomic commits that can easily be reverted or cherry-picked
- Branches for larger changes
- An overview of the project’s history
I don’t need pull requests or CI. Usually these repos will never leave my computer. I practice trunk-based development (learned that at Etsy), so I just commit to main and continue.
Picking an origin
You can have your origin anywhere. It can be a path on disk just as easily as a URL. All my projects are started on an external drive mounted at /media/lab.
That lets me init a bare repo to be the origin for my experiment. No auth is required since it’s not on the internet:
git init --bare /media/lab/experiment
I can then clone the repo to my local machine and start coding:
git clone /media/lab/experiment ~/Workspace/experiment
Or if I have a repo on my local machine, I can just set the origin to my bare repo and push:
git remote add origin /media/lab/experiment
git push -u origin main
If I want to be able to access my repo from other machines without swapping hard drives around, or I want a backup of my work, I can put my bare repo on a VPS and serve it through a subdomain:
ssh [email protected] git init --bare experiment.git
git remote set-url origin [email protected]:experiment.git
git push -u origin main
Once I’m happy with my experiment and want to share it with others, I can just change the origin to my GitHub repo and push:
git remote set-url origin [email protected]:ahashim/experiment.git
git push -u origin main
Browsing history
I like being able to see my git log as a graph:
git log --all --graph

I also enjoy having a UI that can show me diffs. Lazygit does this for me:
lazygit

And when I want something I can leave open in my browser, I run a Git WebUI server:
git webui

I leave this open in my bookmarks. It doesn’t have all the features of GitHub, but I don’t feel like I’m missing anything. Just remember that anyone on your network can clone this repo while it’s running.
This is a simple way to keep your code organized while experimenting. If your experiment becomes something you want to share, you can always push it to GitHub.