3 ms·
Ask HN: How do you keep personal modifications to a public repo private?
When I work on a someone else's public repo I might add a little extra
scaffolding around it like:
* Scripts to install/configure any prerequisites for my distro
* Scripts to launch a VM/container to work inside
* Editor/IDE config files to setup the project's linting/testing etc
It's not useful to anyone else, it should stay on my machine. But I:
* Don't want to change the repos .gitignore
* Still want to use source control on these files
Are there any tools out there to help? How do you solve this?
- coffeebeanHH 4y agoJust work in a separate branch, keep it on track with the master branch and just don't push it.
- ian_hn 4y agoThis is quick and easy. However if you need to work across more than one branch it might become tricky to manage, might need to cherry-pick commits carefully.
- bwindsor 4y agoIf all the stuff you want to ignore is inside another folder, you can create another .gitignore inside that folder containing just * (i.e. ignore everything). Everything including the .gitignore file itself will be ignored.
- ian_hn 4y agoThis works really well to hide stuff from the public repo. The only downside is I don't think it's possible to then use source control on the ignored files in that folder. But if that's not a requirement it's probably the best way to go.
- eternityforest 4y agoWhat about adding .myname-local folder(Or some other name nobody else will use) which is actually a symlink to a separate repo.local folder. Use a global gitignore to ignore the symlink. You could even have a script to git clone, make the local dir, and git init it. Ideally some kind of global convention could be defined for the local folder name, for consistency, reusable tools, and so everyone could know to stay away from it for nonlocal stuff.
- ian_hn 4y agoI think this solves the problem really well, allowing source control on the separate folder as well.