r/adventofcode • u/torbcodes • Dec 09 '23
Tutorial (RE not sharing inputs) PSA: "deleting" and committing to git doesn't actually remove it
Hey all, I looked through a large sample of the repo's y'all are sharing via GitHub in the solution megathreads and I noticed a number of you have done the right thing and deleted your inputs.
BUT... many of you seem to have forgotten that git keeps deleted stuff in its history. For those of you who have attempted to remove your puzzle inputs, in the majority of cases, I was able to quickly find your puzzle inputs in your git history still. Quite often by simply looking for the commit "deleted puzzle input" or something like that (the irony!).
So, this is a PSA that you can't simply delete the file and commit that. You must either use a tool like BFG Repo Cleaner which can scrub files out of your commit history or you could simply delete your repository and recreate it (easier, but you lose your commit history).
Also there's still quite a lot of you posting your puzzle inputs (and even full copies of the puzzle text) in your repositories in the daily solution megathreads. So if any of you happen to see this post, FYI you are not supposed to copy and share ANY of the the AoC content. And you should go and clean them out of your repo's.
EDIT: related wiki links
- Do not share your puzzle input
- Do not ask others to share their puzzle input
- Do not include puzzle inputs in your repo without a .gitignore
- Do not include puzzle text in your repos
EDIT 2: also see thread for lots of other good tips for cleaning and and how to avoid committing your inputs in the first place <3
13
u/dev_null_developer Dec 09 '23
I’d suggest adding your input file to your user .gitignore so you don’t accidentally commit it in the first place
14
u/msqrt Dec 09 '23
I'm still somewhat uncertain what harm it does to share your input, but I just never commit them since it's not difficult and we've been asked not to.
31
u/HzbertBonisseur Dec 09 '23
Using
git filter-branch -f —tree-filter 'rm -rf inputs/*.txt' HEADdid the cleanup for me.2
u/daggerdragon Dec 09 '23 edited Dec 09 '23
Changed flair from
OthertoTutorial.OP: you may also want to add the relevant wiki links to your post:
.gitignore4
u/thygrrr Dec 09 '23
Delete the file, and rebase your repo / force-push to a history that doesn't include the inputs.
3
u/fragger Dec 10 '23
git filter-repo --path-glob "2022/*/input" --invert-paths --forcewas the nice way to fix this for me. Edit the glob to match how you had inputs saved1
u/Markavian Dec 09 '23
I got called out by a mod, so I made my tool for this to scrub all my repos historically and create an updated .gitignore file.
https://github.com/connected-web/jumper?tab=readme-ov-file#aoc
1
u/Dullstar Dec 09 '23
Thanks for the reminder to check.
I thought I deleted them last year, but it seems I only stopped adding new ones and never removed the old ones (I think I was intending to create documentation of where the inputs were expected to be first and then forgot about it).
2
u/zuth2 Dec 09 '23
TIL I wasn't supposed to share my puzzle input.
2
u/sansskill Dec 10 '23
Thanks for the reminder, double checked my repo and realized that my .gitignore was not working properly so I commited my puzzle inputs every day. Luckily it was an easy fix with force push.
1
u/JP-Guardian Dec 09 '23
I assume it’s okay having the test input from the day’s problem statement in our repo?
1
u/fogcat5 Dec 09 '23
python and other languages have nice helper libs like aocd that will let you fetch the data but not store it in github