News for hackers. Stuff that matters.

Show HN: Everybody should create a practice repo

https://github.com/SriLikesToSing/practice

Hi everybody, I personally found the best way to motivate yourself to program everyday is by creating a practice repo and by uploading anything you code up that day into this repo. This is a great way to stay consistent seeing the bright green light up every time you push your code. It's very addicting and satisfying, and has definitely made me a better programmer over the past few months.
( 16 comments | 3 points | on HN )
Re:Show HN: Everybody should create a practice repo by adlpz on Saturday November 12, 2022 @02:42AM (#33570990)
Hey, that's a cool idea.

In my case, not so much because of the "motivate myself to program everyday" because, well... that's my job, I've programmed every (work)day for many years now.

But it does seem to be a cool way of collecting all the little experiments and fun projects in a single place where you can share them and keep a timeline of what you did.

I'm staring mine.

Re:Show HN: Everybody should create a practice repo by Sri_Aditya on Saturday November 12, 2022 @11:57AM (#33574823)
Yeah, its obviously not a place for official projects but a way to store your tinkering and to motivate yourself to tinker more with those green lights.
Re:Show HN: Everybody should create a practice repo by spoiler on Saturday November 12, 2022 @05:13AM (#33571767)
That's a good idea! I have some of my old projects on GitHub archived now, and when I tend to learn new languages. I tended to be rebuild an old pet project of mine in it a as it touches a few domains (a graphical comic book style chat app). And a few times I did a `learning-x` repo, but they weren't as comprehensive as this
Re:Show HN: Everybody should create a practice repo by Sri_Aditya on Saturday November 12, 2022 @11:56AM (#33574813)
The graphical style comic book chat app intrigued me! Very interesting idea.
Re:Show HN: Everybody should create a practice repo by eurasiantiger on Saturday November 12, 2022 @06:38AM (#33572163)
Somehow, this seems like a terrible idea.

https://github.com/SriLikesToSing/practice/blob/master/tinke...

What other interesting things could one find in this repository?

Re:Show HN: Everybody should create a practice repo by KronisLV on Saturday November 12, 2022 @07:20AM (#33572377)
The person seems relatively young age wise and thus is probably in the process of learning things.

Please don't be overly negative about low quality code in their personal repo, which might be more or less of a scratch pad, since that is very demotivating.

That said, personally I'd suggest keeping one's code in separate repos with corresponding READMEs, since otherwise it's pretty hard to realize what you were doing a few months down the line: https://www.readme-templates.com/

Furthermore, separate repos are a good idea if you ever want any CI introduced for the project, or build any libraries from it. There's nothing wrong with monorepos, but even those are typically used within the context of a particular project or group of projects.

Re:Show HN: Everybody should create a practice repo by eurasiantiger on Saturday November 12, 2022 @07:54AM (#33572575)
I was more referring to the apparent accidental inclusion of completely unrelated access credentials. That’s something they’re now learning the hard way.

Maybe don’t get in the habit of committing everything in your learning repo, just in case you’ve accidentally saved something else there.

Re:Show HN: Everybody should create a practice repo by KronisLV on Saturday November 12, 2022 @08:26AM (#33572835)
> I was more referring to the apparent accidental inclusion of completely unrelated access credentials. That’s something they’re now learning the hard way.

That's a good point, though! Comment edited.

Re:Show HN: Everybody should create a practice repo by Sri_Aditya on Saturday November 12, 2022 @11:25AM (#33574503)
yeah this seems like a really good idea! I always create new separate repos for official projects so that's always good.
Re:Show HN: Everybody should create a practice repo by Sri_Aditya on Saturday November 12, 2022 @11:21AM (#33574469)
haha yep. I knew this would happen. I would definately be on the more careless side though, and I'm sure that 99% of people would not be as careless as me when uploading their files.
Re:Show HN: Everybody should create a practice repo by eurasiantiger on Saturday November 12, 2022 @05:21PM (#33577743)
Do note that you can’t just commit them away — in fact, doing that will just create a nice log of things you have deleted, and the files themselves are still a part of the git history.

What you need to do is an interactive rebase, go through all commits, and remove the files by editing the original commits. You can do this with git rebase -i but it is very labor intensive and requires a lot of concentration to get right.

Afterwards your local history will have diverged from GitHub and you need to git push -f to replace the commit history on GitHub with that of your local repository.

It might be a good idea to make the repository private until you have changed all of your passwords and made sure there is no such material in the repository’s history. That doesn’t help if someone already cloned it, though.

Good luck in any case. Hope you have strong passwords and 2FA on your Steam and Gmail.

Re:Show HN: Everybody should create a practice repo by Sri_Aditya on Saturday November 12, 2022 @06:27PM (#33578289)
thank you, I will do this immediately.
Re:Show HN: Everybody should create a practice repo by Madeindjs on Saturday November 12, 2022 @05:10PM (#33577650)
Re:Show HN: Everybody should create a practice repo by electromech on Saturday November 12, 2022 @06:11PM (#33578144)
As others have noted, you have what appear to be credentials in your repo. If any of those are real, change those passwords immediately. Removing them from your git history only after you've invalidated the credentials.

---

Like, right now.

---

I also use a personal monorepo for all my projects, including an "experimental" directory for one-off things. However, I am (and you should be) much more careful about what gets committed.

One of my rules is that credentials never belong in the same directory tree as the repository. Entries in .gitignore are not sufficient to prevent accidentally committing sensitive info to the repo. Occasionally this rule takes a little effort -- e.g., some project templates default to using ".env" files for secrets, and to uphold my rule, I need to understand the tool well enough to configure a secure alternative.

Another thing that I find helpful for managing a large number of throwaway projects: a global .gitignore with defaults like "node_modules/", "target/" etc.

Re:Show HN: Everybody should create a practice repo by Sri_Aditya on Saturday November 12, 2022 @06:13PM (#33578168)
thank you for the heads up. I will do this immediately.
Re:Show HN: Everybody should create a practice repo by electromech on Saturday November 12, 2022 @06:55PM (#33578475)
Rock on. Hack on, my friend!